3. What will be the output of following code :
// Assume all header files are included
int main(void)
{
int cog=15,bog=23,c;
c=subtract(cog,bog);
return 0;
}
int subtract(int a,int b)
{
return a-b;
}
A. -8
B. 8
C. 0
D. ERROR – Function subtract needs to be declared before main() or function prototype must be provided .
View Answer & Explanation
Ans. d
4. What will be the output of following code :
int main(void)
{
int k=7;
float l=7;
if(k==l)
{
printf("EQUAL\n");
}
else
{
printf("NOT EQUAL\n");
}
return 0;
}
A. EQUAL
B. NOT EQUAL
C. Error
D. None of these
View Answer & Explanation
Ans. A
Explanation : Perfect example of type promotion.