What will happen when you execute this code snippet?

Advertisement

#include <iostream>

int main() {
float a = 5.51;
int b = static_cast<int>(a);
std::cout << b;
}

  • 6 will be printed on standard output, with no compilation warnings generated.
  • 5 will be printed on standard output, with no compilation warnings generated.
  • 6 will be printed on standard output, with compilation warnings generated.
  • 5 will be printed on standard output, with compilation warnings generated.
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment


Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.