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")?

Answers were Sorted based on User's Feedback



What is the output of printf("%d")?..

Answer / sathiyaraj.m

it will print the garabage value,it will not show any error

Is This Answer Correct ?    3 Yes 1 No

What is the output of printf("%d")?..

Answer / arun katal

it's only print value 'o' or if we take any variable
with define it print define value of variable.

Is This Answer Correct ?    2 Yes 0 No

What is the output of printf("%d")?..

Answer / hafizul

the value at the top of the stack will be printed.
if some value is assigned to some variable before dis stmnt
then that value will be printed, otherwise some garbage
value(that r at the top of the stack) will be printed.

Is This Answer Correct ?    2 Yes 1 No

What is the output of printf("%d")?..

Answer / aaru

garbage value

Is This Answer Correct ?    2 Yes 1 No

What is the output of printf("%d")?..

Answer / prabhu

It will rpint garbase.

Is This Answer Correct ?    2 Yes 1 No

What is the output of printf("%d")?..

Answer / sonia

It will display garbage value

Is This Answer Correct ?    2 Yes 1 No

What is the output of printf("%d")?..

Answer / masquerade

for int and char specifier it prints garbage value
and for float it will give error

Is This Answer Correct ?    1 Yes 0 No

What is the output of printf("%d")?..

Answer / jeni

The output will be a garbage value.

Is This Answer Correct ?    1 Yes 0 No

What is the output of printf("%d")?..

Answer / 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

What is the output of printf("%d")?..

Answer / kanchan

%d prints integer value but we have to provide corresponding variable with it i.e..
printf("%d" n) here it prints value of n which is of integer type
printf("%d") will create a garbage value b'coz copiler is unknown of associated variable.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C++ General Interview Questions

What are the various compound assignment operators in c++?

0 Answers  


If you hear the cpu fan is running and the monitor power is still on, but you did not see anything show up in the monitor screen. What would you do to find out what is going wrong?

0 Answers  


What are different types of loops in c++?

0 Answers  


What are dynamic type checking?

0 Answers  


Can I learn c++ as my first language?

0 Answers  


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

0 Answers  


Write a program for Divide a number with 2 and Print the output ( NOTE: Check for divide by zero error).

0 Answers  


Array base access faster or pointer base access is faster?

0 Answers  


Program to check whether a word is a sub-string or not of a string typed

0 Answers  


Can I have a reference as a data member of a class? If yes, then how do I initialise it?

0 Answers  


What is the difference between a class and a structure in C++?

1 Answers  


Why c++ is the best language?

0 Answers  


Categories