How to Output Text/String in C Programming

In C programming we use printf function (which is part of stdio.h library) to print / output some text or variable on the screen. Following simple C program outputs a text on the screen. It also explains how to move to the new line and how to add tabbed space between words.

[js]
#include <stdio.h>

int main( void ){
// lines starting with double slashes are called as comments.
//Comments are used to explain code and they are not executed by compiler

printf("Welcome to C!n"); // n moves the cursor to the new line
printf("Hello My Name is Junaid Hassant We added tabbed spacen"); // t adds tabbed space

return 0;
}
[/js]

One thought on “How to Output Text/String in C Programming

Leave a Comment

Your email address will not be published.