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

What is pointer & why it is used?

0 Answers  


What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

0 Answers  


main() { int a,b; printf("%d,%d",scanf("%d%d",&a,&b)); } => do u mean above program's output... =>output will be:2,whatever you enter value for b. =>because scanf is a library fn which will return how many arguements it processes, and second value you are right mr.Satya but i found my self unable to understand that for the first time scanf returns the no of successful matches but how for the second time it returns the value of 'b'.while a function should return the same 'r' value every time.

1 Answers   Cisco,


What is the scope of static variable in c?

0 Answers  


How does placing some code lines between the comment symbol help in debugging the code?

0 Answers  






Explain modulus operator. What are the restrictions of a modulus operator?

0 Answers  


7. Identify the correct argument for the function call fflush() in ANSI C: A)stdout B)stdin C)stderr D)All the above

10 Answers   Accenture,


why i join syntel?

23 Answers   ABC, Syntel, TCS,


Explain what is meant by high-order and low-order bytes?

0 Answers  


What is the modulus operator?

0 Answers  


f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { char *p="bye"; f(p); printf("%s",p); } what is the o/p?

7 Answers   Hughes,


Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

0 Answers  


Categories