🎴 Flashcard Mode
C++ Programming
Card1 / 15
Mastered0
Review0
QuestionClick to flip
What is the output of C++ program given below?
#include<iostream>
using namespace std;
int main()
{
typedef int hello;
hello i=9.9;
cout<<i;
}
AnswerClick to flip back
A
9
💡 Explanation:
typedef creates a new name for a given datatype.
typedef int hello; //hello is the new name of integer datatype.
hello i=9.9;
cout<<i;
Which displays value of 'i'.
As 'i' is of integer datatype because is declared as hello type which is the name given to integer datatype using typedef.
Hence, prints 9.