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

Answer Posted / nithya

%d print the value for example
int x=2;
printf("x=%d",x);

output:

x=2

%*d print the value for example
int x=2;
printf("x=%*d",x);

output:

x= 2

the output two space(x=2) next the value will be display
(x=6) the output 6 space next the value will be display

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 scope rule in c?

597


how to write optimum code to divide a 50 digit number with a 25 digit number??

2743


Explain enumerated types in c language?

598


What is indirection in c?

614


write a program to print largest number of each row of a 2D array

1862






Explain why c is faster than c++?

564


What are the advantages and disadvantages of c language?

550


What is union and structure in c?

606


Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon

1730


What are the advantages of union?

620


i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none

634


Write a program to swap two numbers without using third variable in c?

607


Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc

5051


What is meant by type specifiers?

651


What is the size of structure in c?

691