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 / apekshit jotwani

Answer will be 15.
Consider a[++i]=x
++i=y
++i=z
so v have to evaluate x+y+z
Compiler converts this to postfix as "xy+z+"
so x is put in the stack 1st i=1,x=a[1]=10
Then i=2, 2 is put in the stack
Then x+y is operated = 12
12 is put in the stack.
Then i=3, 3 is put in the stack.
Then 12+3=15,
only 15 is put in the stack. That is the final answer

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I sort more data than will fit in memory?

1045


Explain the difference between malloc() and calloc() function?

991


How can I discover how many arguments a function was actually called with?

1022


What are the types of operators in c?

1007


What is the use of printf() and scanf() functions?

1073


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2817


how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions

3133


what is a constant pointer in C

1098


Can the size of an array be declared at runtime?

1031


There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?

1245


Why isn't it being handled properly?

1007


Write program to remove duplicate in an array?

1031


What do you mean by dynamic memory allocation in c? What functions are used?

1112


Explain Function Pointer?

1106


What is the value of h?

993