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

Is it possible for the objects to read and write themselves?

0 Answers  


What is the arrow operator in c++?

0 Answers  


Describe run-time type identification?

1 Answers  


A prime number is a number which is divisible only by itself and 1. Examples of the first few primes are 2, 3, 5, 7, 11. Consider writing a program which can generate prime numbers for you. Your program should read in and set a maximum prime to generate and a minimum number to start with when looking for primes. This program should be able to perform the following tasks: 1. Read the maximum number from user (keyboard input) to look for primes. The program should not return any primes greater than this number. 2. Read the minimum number from user (keyboard input) to look for primes. The program should not return any primes less than this number. 3. Generate and print out every prime number between the maximum prime and minimum number specified by the user.

0 Answers  


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

0 Answers  






Which bit wise operator is suitable for putting on a particular bit in a number?

0 Answers  


How do I write a c++ program?

0 Answers  


Can I uninstall microsoft c++ redistributable?

0 Answers  


What does the ios::ate argument do?

0 Answers  


What do you mean by “this” pointer?

0 Answers  


What are manipulators used for?

0 Answers  


Badboy is defined who has ALL the following properties: 1. Does not have a girlfriend and is not married. 2. He is not more than 23 years old. 3. The middle name should be "Singh" 4. The last name should have more than 4 characters. 5. The character 'a' should appear in the last name at least two times. 6. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers

1 Answers  


Categories