C language basics

,

I found something while learning basics of C.
What is the meaning of statement *printf("%d",a);

1 Like

@while_1
what I know is this is used to restrict some input…further u can refer to this:-


Hope this helps!!

1 Like

***** or any value indicates a width field.

**"The width field may be omitted, or a numeric integer value, or a dynamic value when passed as another argument when indicated by an asterisk . For example, printf("%d", 5, 10) will result in 10 being printed, with a total width of 5 characters." --> From wiki https://en.wikipedia.org/wiki/Printf_format_string
Try this with your compiler.
Hope this helps!! Thank you.

1 Like

Thanks for help

Thank you:)

Its good that you have a curious mind! I would recommend checking how it affects the output and analysing it too. Also, sites like stackoverflow etc. should help you further! :slight_smile:

1 Like

Yes,right.

Follow this link [http://stackoverflow.com/questions/20118716/what-is-d-in-c][1]
[1]: http://stackoverflow.com/questions/20118716/what-is-d-in-c*

1 Like

printf("");

This function is used to print on the output screen

it may be string,character,integer,double…and many other things…
with the help of percentage specifiers…!

it even works with scanf for example… consider this: scanf("%*d%d",&n);

As you have already got the right answer but apart from that i would like to suggest you to learn basic of printf() function. Just have a look upon how printf() function works and how many arguments, parameters, definitions are required.

Here is the link of this where you will not only got about the width that above answers specified but you will also get to know about other pretty things.