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
State two uses of pointers in C?
Can we use any name in place of argv and argc as command line arguments?
Explain what is the use of a semicolon (;) at the end of every program statement?
How do I use strcmp?
What is pointer to pointer in c with example?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
When do we get logical errors?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
Are negative numbers true in c?
What are the restrictions of a modulus operator?
How do you redirect a standard stream?
what is the height of tree if leaf node is at level 3. please explain
All technical questions
Are pointers integers in c?
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)