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 a null pointer in c?
What are the similarities between c and c++?
What is double pointer?
What is the advantage of a random access file?
How can I do peek and poke in c?
What is "Hungarian Notation"?
Find MAXIMUM of three distinct integers using a single C statement
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
Explain what are reserved words?
Explain pointers in c programming?
What does c mean before a date?
Stimulate calculator using Switch-case-default statement for two numbers
What is the purpose of void pointer?
What is cohesion in c?
What is a pragma?