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 will be the output of this program?
void main()
{
int a[]={5,10,15};
int i=0,num;
num=a[++i] + ++i +(++i);
printf("%d",num);
}

Answer Posted / ricky

Garbage Value

num=a[++i] + ++i +(++i);
in this line the last i will be incremented first
so the last ++i will return 1 after that the middle ++i will return 2 now the value of i will change every where in the program now the first ++i will return 3 since the array starts with a[0] and ends at a[2] there is no a[3] and hence it will print garbage value

Is This Answer Correct ?    5 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are reserved words?

1043


How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

1128


What will the preprocessor do for a program?

1014


Why do we need functions in c?

952


What is time complexity c?

939


Are the variables argc and argv are always local to main?

969


What does typeof return in c?

1018


Can you write the function prototype, definition and mention the other requirements.

1082


Explain what does the format %10.2 mean when included in a printf statement?

1289


Explain how can you avoid including a header more than once?

1038


Why is sprintf unsafe?

997


What is the benefit of using #define to declare a constant?

1042


Explain output of printf("Hello World"-'A'+'B'); ?

1429


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1664


What is graph in c?

1005