what is the output of the program??
#include<stdio.h>
main ( )
{
int a=010,sum=0,tracker:
for(tracker=0;tracker<=a;tracker++)
sum+=tracker;
printf(ā %d\nā,sum);
}
what is the difference between a=10 and a=010??
Answer Posted / vidyullatha
In linux:
Answer is 36 instead of 55.
i.e the loop iterates till tracker=8 instead of tracker=10.
Thats is because, I guess when u initialise a=010, compiler
takes a = octal 10 i.e in decimal it is 8.
So the loop iterates through tracker<=8.
This is my guess. I am not sure of the real answer.
Please let me know if any one knows the right answer.
| Is This Answer Correct ? | 12 Yes | 1 No |
Post New Answer View All Answers
Why does this code crash?
What do you understand by friend-functions? How are they used?
Is c++ based on c?
What is ambagious result in C? explain with an example.
Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?
What is the default value of local and global variables in c?
Does c have class?
Is main is a keyword in c?
In C programming, how do you insert quote characters (ā and ā) into the output screen?
Explain what is the difference between functions getch() and getche()?
Write a Program to find whether the given number or string is palindrome.
Why #include is used in c language?
What is "Hungarian Notation"?
What does node * mean?
What are comments and how do you insert it in a C program?