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
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 |
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 |
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 |
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 |
Answer / ajay kumar
error:
because declaration terminated incorrectly.
Is This Answer Correct ? | 1 Yes | 1 No |
Is main an identifier in c?
If the static variable is declared as global, will it be same as extern?
what is the value of 'i'? i=strlen("Blue")+strlen("People")/strlen("Red")-strlen("green")
7 Answers Cadence, JNTU, Zen Technologies,
no consistent academics. how to answer the question
What are dangling pointers in c?
write a program in c language to print your bio-data on the screen by using functions.
What happens if header file is included twice?
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?
write a program to remove duplicate from an ordered char array? in c
What header files do I need in order to define the standard library functions I use?
Evaluate the following: int fn(int v) { if(v==1 || v==0) return 1; if(v%2==0) return fn(v/2)+2; else return fn(v-1)+3; } for fn(7); 1) 10 2) 11 3) 1
What is the difference between formatted&unformatted i/o functions?