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
Can a variable be both constant and volatile?
What is an auto keyword in c?
What is the difference between new and malloc functions?
What is header file definition?
What is define directive?
What are the preprocessor categories?
write a program to generate address labels using structures?
What is a file descriptor in c?
Can you write the algorithm for Queue?
Explain what are binary trees?
How can I implement sets or arrays of bits?
Suggesting that there can be 62 seconds in a minute?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
What is the use of in c?