what is the difference between %d and %*d in c languaga?

Answer Posted / sivakumar

anand and manini your expectations are wrong. because %d
give the original value of the variable and %*d give the
address of the variable.
eg:-
int a=10,b=20;
printf("%d%d",a,b);
printf("%*d%*d",a,b);

result is 10 20 1775 1775
here 1775 is the starting address of the memory allocation
for the integer.a and b having same address because of
contagious memory allocation.

Is This Answer Correct ?    35 Yes 19 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain bit masking in c?

639


What is memory leak in c?

637


What does %d do?

726


Difference between MAC vs. IP Addressing

643


How can I automatically locate a programs configuration files in the same directory as the executable?

632






How would you obtain the current time and difference between two times?

730


Why can arithmetic operations not be performed on void pointers?

590


What are the 4 types of organizational structures?

625


When should you not use a type cast?

661


Explain what is a static function?

633


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

666


What is array in c with example?

617


What is main function in c?

551


Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)

815


What is c variable?

554