C Programming - Input / Output - Discussion

Discussion Forum : Input / Output - Yes / No Questions (Q.No. 3)
3.
Will the following program work?
#include<stdio.h>

int main()
{
    int n=5;
    printf("n=%*d\n", n, n);
    return 0;
}
Yes
No
Answer: Option
Explanation:
It prints n=    5
Discussion:
22 comments Page 2 of 3.

Lakshmidevi said:   1 decade ago
Using * means it skips one variable, so only one n value is taken and another n value is ignored.

Nandish said:   6 years ago
Here the spaces are printed in the first n and for the second n, the value has assigned. !

Medha said:   1 decade ago
One n is ignored with 4 space because of '*'and another n value is taken.

Veena said:   1 decade ago
I thought here two n's are not required. Please any one can explain.

PG srinu said:   1 decade ago
I think exactly * will ignore first variable then k l printed.

Hero said:   8 years ago
Can anyone explain how many spaces were there in the answer?

Madhusudan said:   1 decade ago
'*' will provide 4 spaces in between 'n=' and 5.

Bambi said:   1 decade ago
What is the significance of '*' in this ?

Nandhu said:   1 decade ago
Please anybody can explain this.

Rozario selvanathan said:   1 decade ago
Anyone please make it clear...


Post your comments here:

Your comments will be displayed after verification.