Question:
What is the output of printf ("%d")
Answer:
Usually the output value cannot be predicted. It will not give any error. It will print a garbage value. But if the situation is
main()
{
int a=1,b=2,c=3;
printf("%d");
}
The output will be the value of the last variable, ie. 3 Source: CoolInterview.com
This will give garbage value. Source: CoolInterview.com
Answered by: Vinayak Koli | Date: 1/12/2008
| Contact Vinayak Koli
It prints garbage value. Source: CoolInterview.com
Answered by: vishwa nerella | Date: 5/27/2009
| Contact vishwa nerella
void main() { int a=1,b=2,c=3; clrscr(); printf("%d"); } output: 3 because convention of storing variables in c is from right to left i.e. c then b then a hence when we print the value of c at the top of the stack and gets printed Source: CoolInterview.com
Answered by: v.bablu | Date: 8/26/2009
| Contact v.bablu
The last value stored in the stack will get printed to the console. Source: CoolInterview.com
Answered by: Dany | Date: 9/18/2009
| Contact Dany
int main() { printf("%d"); return 0; }
This program print 0(zero). I have tried it in visual c++ and turbo c. Source: CoolInterview.com
Answered by: prakash ranjan | Date: 12/2/2009
| Contact prakash ranjan
void main() { int a=1,b=2,c=3; clrscr(); printf("%d"); } output: 3 because convention of storing variables in c is from right to left i.e. c then b then a hence when we print the value of c at the top of the stack and gets printed Source: CoolInterview.com
Answered by: Samuel | Date: 1/27/2010
| Contact Samuel
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|