What will be the output of given program?
#include<stdio.h>
void main()
{
int a=1;
if("%d=hello", a);
}
#include<stdio.h>
void main()
{
int a=1;
if("%d=hello", a);
}
A. complier error
B. no error no output
C. 0
D. 1
Answer: Option B
Solution(By Examveda Team)
the if
is conditional and it checks for expression whether it is zero or non-zero so it doesn't print any data it is clear and it is clearly seen that there is not a single syntax error therefore no complier error.
After compling the program will be executed but there is not a single printf statement so it is executed but will not give any output.
Which control structure is used to repeatedly execute a block of code in C?
A. for loop
B. if statement
C. switch case
D. while loop
In C, what is the purpose of the 'break' statement within a loop?
A. Continue to the next iteration
B. Exit the program
C. Terminate the loop and exit it
D. Skip the current iteration
What is the purpose of the 'else' statement in C's 'if-else' control structure?
A. Execute the 'if' block
B. Execute the 'else' block
C. Execute both 'if' and 'else' blocks
D. Skip the 'if' block
Which control structure is used to make a decision between two or more alternatives in C?
A. switch case
B. for loop
C. if statement
D. while loop
Join The Discussion