int main()
{
int x = (2,3,4);
int y = 9,10,11;
printf("%d %d",x,y);
}
what would be the output?
Answer Posted / vadivelt
1.Error. Because the syntax of statement int y = 9,10,11;
is wrong. it is not allowed to initialise a variable "int y
= 9,10,11;" with this syntax because it will be treated as
constant. But it is allowed to keep the values inside of
braces in the initialisation. ie., int x = (2,3,4);
2.If the program is written as like below, output would be
4 9.
int main()
{
int x, y;
x = (2,3,4);
y = 9,10,11;
printf("%d %d",x,y);
getch();
}
Cos the precedence of statement x = (2,3,4); is left to
right. and for y = 9,10,11; the precedence would be right
to left.
So the latest assigned values to x and y would be 4 and 9.
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What is storage class?
What's the right way to use errno?
How do we print only part of a string in c?
What are the rules for identifiers in c?
Is it possible to execute code even after the program exits the main() function?
Should I learn c before c++?
Where define directive used?
State the difference between realloc and free.
What is struct node in c?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
Is stack a keyword in c?
What is the c value paradox and how is it explained?
When the macros gets expanded?
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
How do I convert a string to all upper or lower case?