This is a discussion on % in C ? within the C and C++ Programming forums, part of the Software Development category; In c we put % before 'd' or '%S' Wt mean by '%'. EXample Printf("%d %s",id,name);...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| hi prasath, % means - print formatting is controlled by 'format identifiers' Example: -------- char name[20] = "Buddies"; int age = 5; printf( "Hello %s, you are %d years old\n", name, age ); displays the following output: Hello Buddies, you are 5 years old 1. The %s means, "insert the first argument, a string, right here." 2. The %d indicates that the second argument (an integer) should be placed there. like that there are different %-codes for different variable types.
__________________ Thanks & Regards Sabari... Last edited by Sabari : 07-16-2007 at 07:30 AM. |
| |||
| Hi sabari, is it possible when u use string insted of format identifier For example: printf( "Hello %s, you are %d years old\n", name, age ); C compilier can accept the above code? Thanks, Prasath.K ![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |