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

Can we declare variable anywhere in c?

539


Write a program to check armstrong number in c?

640


Compare and contrast compilers from interpreters.

684


what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)

1933


Explain how can a program be made to print the name of a source file where an error occurs?

693






how is the examination pattern?

1599


What is realloc in c?

581


A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?

1516


Can we declare function inside main?

572


What is printf () in c?

582


How can I rethow can I return a sequence of random numbers which dont repeat at all?

710


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

909


Why do we use header files in c?

588


What is the purpose of realloc()?

676


Explain indirection?

650