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 printf("%d")?

Answer Posted / arvind kumar yadav

When we use %d the compiler internally uses it to access
the argument in the stack (argument stack). Ideally
compiler determines the offset of the data variable
depending on the format specification string. Now when we
write printf("%d",a) then compiler first accesses the top
most element in the argument stack of the printf which is %
d and depending on the format string it calculated to
offset to the actual data variable in the memory which is
to be printed. Now when only %d will be present in the
printf then compiler will calculate the correct offset
(which will be the offset to access the integer variable)
but as the actual data object is to be printed is not
present at that memory location so it will print what ever
will be the contents of that memory location.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is vector a class in c++?

1039


What is polymorphism in c++? Explain with an example?

1033


What is the main purpose of c++?

1062


Explain the purpose of the keyword volatile.

1167


How can you tell what shell you are running on unix system?

1111


What is constructor c++?

1114


How many types of classes are there in c++?

1038


What is a singleton c++?

1002


Explain virtual class and friend class.

1046


Evaulate: 22%5 a) 2 b) 4 c) 0

1086


Will c++ be replaced?

1040


Is c++ the best programming language?

1012


What is implicit conversion/coercion in c++?

1440


Which header file allows file i/o with streams a) fileio.h b) iostream.h c) fstream.h

1129


How to access a variable of the structure?

1083