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??
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / xyz
near keyword int there is a colon so isnt tat a compling error
| Is This Answer Correct ? | 0 Yes | 0 No |
Explain what is wrong with this program statement? Void = 10;
Explain what are bus errors, memory faults, and core dumps?
What is the difference between macros and inline functions?
WRITE A C PROGRAM FOR PRINT "RHOMBUS" STRUCTURE . Example: Enter the numbers :3 * * * * * * * *
What are the similarities between c and c++?
What are the types of assignment statements?
Program to simulate second clock
How can I remove the trailing spaces from a string?
Why string is used in c?
Which is not valid in C? 1) class aClass{public:int x;} 2) /* A comment */ 3) char x=12;
What is the purpose of the statement: strcat (S2, S1)?
Explain how do you sort filenames in a directory?