Control Strings Using In printf() And scanf()

#include < stdio.h>

void main() {     printf("nHello Worldn"); } The statement above printf("nHello Worldn");  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 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

Post Comment
Login to post comments