What is the difference between %d and %*d in C

Answer Posted / meruva

%d means it prints only given value,
and %*d means it prints garbage value.
for eg: //it prints i value is=10
int i=10;
printf("i value is=%d",i);

//it prints garbage value
int i=10;
printf("i value is=%*d",i);

Is This Answer Correct ?    5 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain a file operation in C with an example.

652


Differentiate between a for loop and a while loop? What are it uses?

663


Write a program to identify if a given binary tree is balanced or not.

678


When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd

637


what is the structure pointer?

1640






What is default value of global variable in c?

556


Can a variable be both constant and volatile?

556


Write a program to find factorial of a number using recursive function.

634


What is hashing in c?

638


What are the disadvantages of c language?

614


What is a void * in c?

589


In which layer of the network datastructure format change is done

1426


What does volatile do?

559


Why do we use static in c?

627


2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier.  Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed.  When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed.  Sequence of take-off is the sequence of addition to the waitlist

2511