In C programming language output functions are the functions through which the result is displayed on the standard output device like monitor.
Following are the output functions of C language –
- putchar( ) – This function displays the character on the screen which is already inputted by using the getchar( ) function. For ex – putchar(ch); This will display the character which was stored in the variable ch.
- putch( ) – This function is almost similar to putchar( ) function. It is used to display only one character on the screen which is stored by using getch( ) function. It’s syntax is same as the putchar fucntion but the keyword here used is ‘ putch ‘ instead of putchar.
- puts( ) – It will display the whole string on the screen which user has already inputted by using the gets( ) function. It can also print the message. After printing the string or message it moves the cursor to the next line. It’s syntax is –
puts(nm); Or puts("Text line or some message") You can also display some text line or message on the screen by using this function with the double quotes.
- printf( ) – This function is used to print both values of variables and messages. It can also display the character strings. The general syntax is –
printf("control strings",v1,v2,v3); printf("message or text line"); for ex - printf("Hello world"); printf(" Sum of two numbers is %d",a); printf("%f,%d",m,a);
You can also use both message and format codes together as you can see in the example.
Thanks for providing the content..
Easy to understand..
Liked it very much..
Please Subscribe my Channel..
https://www.youtube.com/channel/UCtt0hdQl-ANb-pk3M8nsZ-w