int a=2,b=3,c=4;
printf("a=%d,b=%d\n",a,b,c);
what is the o/p?

Answer Posted / vignesh1988i

this reply for Mr. Sanjay..........

one thing to understand , unless or until we initilize or get i/p from the user to any variables their GARBAGE CONTENT will be there inside the variable .... so like this u are printing the value of variable a wit out initilizing or feeding the i/p from the user.... SO FIRST PRINTF will show only garbage values , so only ur first output is -12.........

in scanf you have missed to specify the location of a where the value must get stored.... so , in the o/p screen u can type the value but it wont get stored in the memory location named as 'a'.... because you didn't specify the memory location of 'a' to the compiler.....

because of this in the next printf statement , it will print some other garbage values... remember that garbage values are subjected to change at instances....

next line you are tyrying to print the address of variable a... know one thing that the addresses are only unsigned ones... but you have given a format specification as %d which refers to a ordinary int or short integer which ranges from -32767 to 32768... so if any value goes beyond 32768 it will take the corresponding negative value.................
the other are commented , so i dont want to comment abt it..


hope you would have understood sir....

thank u

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I need previous papers of CSC.......plz help out by posting them.......

1818


What is uint8 in c?

642


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

733


any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above

632


What does the c preprocessor do?

623






why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

654


Is main an identifier in c?

603


What are the loops in c?

593


Which are low level languages?

636


What is difference between && and & in c?

599


which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above

1138


find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }

1859


Are the variables argc and argv are local to main?

789


What is wrong with this initialization?

593


What is wrong in this statement? scanf(ā€œ%dā€,whatnumber);

728