Control Strings Using In printf() And scanf()

Computer Education, Training & Tutorial Resources - ComputerEducationWorld.com
Home » Free Educations » Free Programming Training » C Programming » C For Beginners »

#include < stdio.h>

void main()
{
    printf(”\nHello World\n”);
}
The statement above printf(”\nHello World\n”);  is simple that it display the string hello world. But what about the \n part? the explanation for this question is given below.

\n stands for a new line
\t stands for a tab
\b stands for a backspace
\0 stands for a null character (the utility of this will be explained later)

Another important character to watch out for is the % symbol. In the control string, this character introduces a conversion for one of the arguments.
%c prints a single character
%s prints a string of characters
%d prints the decimal value of the integer argument
%o prints the octal value of the integer argument
%x prints the hexadecimal value of the integer argument
%f prints the floating point argument as [-]mmm.nnnnn
%e prints the floating point argument as [-]m.nnnnnnE[/-]xx+
%g uses %e or %f, whichever is shorter


• • •
 



captcha PHP Script Free PHP captcha script free php
Website Design by WebWalas.com