what is the use of %, $ , # in C language.
we know that %d is for int %s 4 string. why is the % specially used. why not # $ etc.
any explanation for this…..
|
Light Poster
|
|
| 19Jun2012,14:29 | #2 |
|
Those are all called format specifiers. Suppose you want to print formatted output you will use those you listed. For example we use % to specify integer, string or float formats. You can also specify number with % stating how you want to print.
Similarly # are mostly used for date format also used as place-holders. Check for specifier in the internet, you will get more useful information than what I am telling here...
arunbharathi
like this
|
|
Mentor
|
![]() |
| 20Jun2012,03:13 | #3 |
|
Strange question; that's the syntax, you just have to get on with it.
But there's nothing magic about a %. It could equally well have been # or $ or anything else. K&R just picked %.
arunbharathi
like this
|

