int main()
{
int x = (2,3,4);
int y = 9,10,11;
printf("%d %d",x,y);
}
what would be the output?

Answers were Sorted based on User's Feedback



int main() { int x = (2,3,4); int y = 9,10,11; printf("%d %d",x,y); } what would be ..

Answer / samrat

Ans is: 4,9

For example

int i = (x, y); // stores y into i
int i = x, y; // stores x into i

Is This Answer Correct ?    5 Yes 1 No

int main() { int x = (2,3,4); int y = 9,10,11; printf("%d %d",x,y); } what would be ..

Answer / hemant kumar

error

Is This Answer Correct ?    6 Yes 2 No

int main() { int x = (2,3,4); int y = 9,10,11; printf("%d %d",x,y); } what would be ..

Answer / 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

int main() { int x = (2,3,4); int y = 9,10,11; printf("%d %d",x,y); } what would be ..

Answer / saranya

you cant initialize values separated by commas for the variables,it may cause errors .so find to initialize properly before setting the values to the variables.

Is This Answer Correct ?    1 Yes 1 No

int main() { int x = (2,3,4); int y = 9,10,11; printf("%d %d",x,y); } what would be ..

Answer / kalyan chukka

in This Given x=(2,3,4) which takes priority from left->right
and given y=9,10,11 So in This it takes priority from right
-> left so answers are

X=4
Y=9

Is This Answer Correct ?    1 Yes 1 No

int main() { int x = (2,3,4); int y = 9,10,11; printf("%d %d",x,y); } what would be ..

Answer / ajay kumar

error:
because declaration terminated incorrectly.

Is This Answer Correct ?    1 Yes 1 No

int main() { int x = (2,3,4); int y = 9,10,11; printf("%d %d",x,y); } what would be ..

Answer / yatish m yadav

x=4 and y=9

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More C Interview Questions

#include<stdio.h> main() { int a[3]; int *I; a[0]=100;a[1]=200;a[2]=300; I=a; Printf(“%d\n”, ++*I); Printf(“%d\n”, *++I); Printf(“%d\n”, (*I)--); Printf(“%d\n”, *I); } what is the o/p a. 101,200,200,199 b. 200,201,201,100 c. 101,200,199,199 d. 200,300,200,100

1 Answers  


Explain what are the different data types in c?

0 Answers  


wat are the two methods for swapping two numbers without using temp variable??

2 Answers  


25. It takes five minutes to pass a rumour from one person to two other persons. The tree of rumour continues. Find how many minutes does it take spread the rumour to 768 persons. ?

11 Answers   CTS, TCS,


what is the most appropriate way to write a multi-statement macro?

1 Answers  






n=7623 { temp=n/10; result=temp*10+ result; n=n/10 }

7 Answers   Wipro,


Describe the difference between = and == symbols in c programming?

0 Answers  


What does double pointer mean in c?

0 Answers  


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

2 Answers   Aricent, Manipal University,


Do you know what is a programing language ?

0 Answers  


Explain what happens if you free a pointer twice?

0 Answers  


Stimulate calculator using Switch-case-default statement for two numbers

0 Answers   Wipro,


Categories