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 following question?

void main()
{
int i=0,a[3];
a[i]=i++;
printf("%d",a[i]
}

Answer Posted / ankur mohan sharma

A garbage value
Explanaiton:-since we have post increment operator applied on i. It's value gets incremented in next statement, so
a[i]=i++ means a[0]= 0
so a[0] is assigned value 0;
and now i becomes 1;
In next statement value of a[i] is to be printed which means value of a[1], which is not initialised. So value printed is a
garbage value.
Remarks
1. An uninitialised variable holds a garbage value.
2. Post increment operator increments value in next line.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between void main and main in c?

1096


Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

1186


Is sizeof a keyword in c?

918


Can the curly brackets { } be used to enclose a single line of code?

1120


How do you view the path?

1077


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

16590


Why c language is called c?

950


Does * p ++ increment p or what it points to?

1055


What type of function is main ()?

996


Why do we use stdio h and conio h?

1032


State two uses of pointers in C?

1009


What is the time and space complexities of merge sort and when is it preferred over quick sort?

1013


How would you obtain the current time and difference between two times?

1237


List some applications of c programming language?

901


What are the loops in c?

943