Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

what is the role you expect in software industry?

2196


Give the rules for variable declaration?

1218


how to capitalise first letter of each word in a given string?

1979


Can we add pointers together?

1110


Write programs for String Reversal & Palindrome check

1133


How can you draw circles in C?

1195


What does the c in ctime mean?

1156


What is the best style for code layout in c?

1138


Explain what are global variables and explain how do you declare them?

1229


What is the difference between class and object in c?

1235


Which programming language is best for getting job 2020?

1097


Do array subscripts always start with zero?

1359


What is the purpose of ftell?

1135


What is an lvalue in c?

1175


How will you declare an array of three function pointers where each function receives two ints and returns a float?

1425