printf function as we know is used to give output on the screen,but while using so many times this function, I stuck at a point that why we use it in this way only ?
printf actually means print format string which helps us to print any variable whether it is integer float character or string. but what we need to do is wehave to tell this that we want to print particular type of variable in our statement.
printf undersatnds it and then converts that variable into string to give output as a statement.
for example:--
int num= 3;
float rate = 3.2;
char letter = 'A';
printf("%d, %f, %c" num, rate, letter);
output:--
3,3.2,A
for further information refer to this article.
printf actually means print format string which helps us to print any variable whether it is integer float character or string. but what we need to do is wehave to tell this that we want to print particular type of variable in our statement.
printf undersatnds it and then converts that variable into string to give output as a statement.
for example:--
int num= 3;
float rate = 3.2;
char letter = 'A';
printf("%d, %f, %c" num, rate, letter);
output:--
3,3.2,A
for further information refer to this article.