Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Use of %, # and $ (http://www.go4expert.com/forums/use-of-and-t28598/)

arunbharathi 19Jun2012 10:19

Use of %, # and $
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…..

sirama 19Jun2012 14:29

Re: Use of %, # and $
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...

xpi0t0s 20Jun2012 03:13

Re: Use of %, # and $
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 %.

All times are GMT +5.5. The time now is 00:21.