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

What are the 4 types of programming language?

1135


What is the difference between far and near in c?

1075


What are directives in c?

980


Is it possible to use curly brackets ({}) to enclose single line code in c program?

1327


Are comments included during the compilation stage and placed in the EXE file as well?

1088


An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array

1146


What is a structure in c language. how to initialise a structure in c?

1067


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

1380


What extern c means?

1011


What is a memory leak? How to avoid it?

1357


What is the use of a semicolon (;) at the end of every program statement?

1520


What are the different file extensions involved when programming in C?

1296


Can you pass an entire structure to functions?

1129


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

1936


What is mean by data types in c?

1037