fbpx

C++ Interview Questions

Bjarne-stroustrup
 
Prev4 of 17Next

According to the C++11 standard, what is the output of this program?

#include <iostream>

void f(float) { std::cout << 1; }
void f(double) { std::cout << 2; }

int main() {
	f(2.5);
	f(2.5f);
}

Answer