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 is a c token and types of c tokens?

1127


how can f be used for both float and double arguments in printf? Are not they different types?

1121


what value is returned to operating system after program execution?

2179


what is bit rate & baud rate? plz give wave forms

2028


What are the difference between a free-standing and a hosted environment?

1342


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

1558


Can we compile a program without main() function?

1179


Does c have enums?

1173


What is use of #include in c?

1220


What is multidimensional arrays

1174


how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software

3371


Are negative numbers true in c?

1107


Combinations of fibanocci prime series

1666


#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }

1208


How can I find out if there are characters available for reading?

1165