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
what is the role you expect in software industry?
Give the rules for variable declaration?
how to capitalise first letter of each word in a given string?
Can we add pointers together?
Write programs for String Reversal & Palindrome check
How can you draw circles in C?
What does the c in ctime mean?
What is the best style for code layout in c?
Explain what are global variables and explain how do you declare them?
What is the difference between class and object in c?
Which programming language is best for getting job 2020?
Do array subscripts always start with zero?
What is the purpose of ftell?
What is an lvalue in c?
How will you declare an array of three function pointers where each function receives two ints and returns a float?