C++ Quiz4 of 173
Difficulty:
⬅️ Prev: 3Quiz ID: 4Next: 5 ➡️

According to the C++23 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);
}
Hint

What is the type of a floating point literal?

Reveal answer

21

Explanation

The type of a floating point literal is double.

⬅️ Prev: 3Quiz ID: 4Next: 5 ➡️