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

how to construct a simulator keeping the logical boolean gates in c

0 Answers  


What is #define in c?

0 Answers  


main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above

0 Answers  


Which of the following are valid "include" formats? A)#include and #include[file.h] B)#include (file.h) and #include C)#include [file.h] and #include "file.h" D)#include <file.h> and #include "file.h"

15 Answers   Accenture,


What does static mean in c?

1 Answers  






Go through this linked list concept.While traversing through the singly linked list sometimes the following code snippet "while(head != NULL)" is used and other times "while(head->link != NULL)"is used(Here head is the pointer pointing to the first node,node has two parts data part and link part).What is the difference between head != NULL and Head->link != NULL and in which situation are they used?

1 Answers   Oracle,


Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.

0 Answers  


what information does the header files contain?

6 Answers   BSNL, Cisco, GDA Technologies,


How can I trap or ignore keyboard interrupts like control-c?

0 Answers  


What is Dynamic Initialization.

3 Answers  


Given an array of characters, how would you reverse it? How would you reverse it without using indexing in the array?

1 Answers   Microsoft,


wtite a program that will multiply two integers in recursion function

4 Answers   TCS,


Categories