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



what is the output of the program?? #include<stdio.h> main ( ) { int a=010,sum=0,t..

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

what is the output of the program?? #include<stdio.h> main ( ) { int a=010,sum=0,t..

Answer / xyz

near keyword int there is a colon so isnt tat a compling error

Is This Answer Correct ?    0 Yes 0 No

what is the output of the program?? #include<stdio.h> main ( ) { int a=010,sum=0,t..

Answer / manish

yes...
this is the case of memory mapping....

Is This Answer Correct ?    3 Yes 4 No

Post New Answer

More C Interview Questions

What are the application of void data type in c?

0 Answers  


what is the flow of execution in cprogram? ex:printf();,scanf();

2 Answers  


Program to find the value of e raised to power x using while loop

5 Answers   IBM, N Tech,


Explain indirection?

0 Answers  


change to postfix a/(b+c*d-e)

8 Answers   Value Labs,






why we wont use '&' sing in aceesing the string using scanf

0 Answers   HCL,


print the pattern 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 if n=5

3 Answers   Winit,


Describe advantages and disadvantages of the various stock sorting algorithms

1 Answers   Microsoft,


write a programme that inputs a number by user and gives its multiplication table.

2 Answers  


Where in memory are my variables stored?

0 Answers  


write a program that will print %d in the output screen??

9 Answers   Infosys,


What is the output of the following program #include<stdio.h> main() { int i=0; fork(); printf("%d",i++); fork(); printf("%d",i++); fork(); wait(); }

8 Answers   ADITI, Adobe,


Categories