int a=2,b=3,c=4;
printf("a=%d,b=%d\n",a,b,c);
what is the o/p?
Answers were Sorted based on User's Feedback
Answer / vignesh1988i
a=2 and b=3;;;; why it dosent print the value of 'c' is...
we didnt specify any format specifications....... so we wont
get c value...
but if we have given the format specifications and if we
dont give any argument to it... the garbage value will be
your o/p
printf("%d");
the o/p is :: some garbage values....
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / vignesh1988i
A=2,B=3
SINCE THEIR IS NO SPECIFIER FOR SPECIFING THE DATA TYPE OF VARIABLER c so only a & b wil get printed
thank u
| Is This Answer Correct ? | 5 Yes | 1 No |
Answer / srinivas
a=2,b=3
(for "c" variable no conversion char is there so it prints
only a&b values)
| Is This Answer Correct ? | 4 Yes | 2 No |
Answer / sanjay
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("\na=%d\n",a);
scanf("a=%d\n",a);
printf("a=%d\n",a);
printf("a=%d\n\n\n",&a);
//scanf("b=%d\n",&b);
//printf("a=%d\n",b);
//printf("a=%d\n",&a);
getch();
}
tell me the output why -12 and -28713 when i was enter 1 or
any digit?
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / 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 |
could u able to tell about suresoft technical session
what is a function pointer and how all to declare ,define and implement it ???
What are the advantages of c preprocessor?
What's the difference between constant char *p and char * constant p?
what is structuer?
How can I call a function with an argument list built up at run time?
What are the different types of constants?
Explain what are the __date__ and __time__ preprocessor commands?
In a byte, what is the maximum decimal number that you can accommodate?
I need a sort of an approximate strcmp routine?
What is the use of function in c?
Badboy is defined who has ALL the following properties: Does not have a girlfriend and is not married. He is not more than 23 years old. The middle name should be "Singh" The last name should have more than 4 characters. The character 'a' should appear in the last name at least two times. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers