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

why do we use # in c-language?

1 Answers  


hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .

0 Answers   Aegis, CDAC, Infosys,


What is the scope of global variable in c?

0 Answers  


Under what circumstances does a name clash occur?

0 Answers   InterGraph,


Describe the order of precedence with regards to operators in C.

0 Answers  






Explain high-order and low-order bytes.

0 Answers  


What is assert and when would I use it?

0 Answers  


What happens if a header file is included twice?

0 Answers  


i need all types of question paper releted to "c" and other language.

0 Answers  


Question 1: You want to conduct a survey within your classroom, on the quality of canteen’s food. You ask each of your class fellows to rank the quality of food between 1 and 5 (1 representing excellent quality and 5 representing worst quality). During the survey, you make a list containing the roll# of student and the opinion given by that student. The list can be as follow Roll # Opinion 234 1 235 1 236 5 237 1 238 2 239 3 240 5 241 5 242 1 To get the results of the survey, you need to determine the frequency of each opinion value. The frequency of an opinion is determined by counting the number of students giving that opinion. For example, for the above list the frequency of opinion value 1 is 4 and frequency of opinion value 4 is 0. After getting the frequency of each opinion, you can easily judge about the quality of the food by seeing through the frequency of each opinion. You need to develop a program to calculate the results of this survey. The program inputs the opinion of 50 students and counts the frequency of each opinion. It then displays a report showing the frequency of each opinion. Sample output: Opinion Frequency Remarks 1 5 Excellent 2 10 Good 3 15 Normal 4 10 Bad 5 10 Really bad

1 Answers  


What is c programming structure?

0 Answers  


what is diff b/w huge & far & near pointer??

1 Answers   HCL,


Categories