programminghead Logo

C Programming Example : Printing Your Name Using C Program

1) First Open You C Programming Software (Turbo C++)
2) Create New File And Save that New File With myname.c name. (here myname is out file name and .c is out C program's Extension that will help our compiler to understand our program's programming language.)
3) Write this code As shown Below:
4) Run your program by pressing ctrl+f9 (Turbo c++ user).

getch():

Usually getch() (getch function) is used to read a character from screen. But here we are using this to add a Pause to our Output Screen. If we don't add this in our program, our program's output screen will close quickly after running our program.

clrscr():

When we run our C Program for 1st time we Get our value. but after making some changes to our C program when we run the program we get out new output with the old output.
To remove those Old/Previews Output/Results values, We use clrscr();.
Where clr(Clear) and scr(Screen) stands for Clear Screen (clrscr).

Printing Name Using C Language


#include<stdio.h>
main()
{

     clrscr();

     printf( " My Name Is Human " );

     getch();

}

Results

My Name Is Human

Example (Explained):

#include<stdio.h> :

#include<stdio.h> is a Header file that includes Slandered (str) Input Output (IO) Library/File. Because All Of the C's In build Functions are declared in <stdio.h> File

main() :

main() (main function) is the entry point of C program. When We Run our C program the execution Control Directly to the main() (main function) and gave us result in output.

printf() :

printf() is also a Function of C. Printf() is used to print “character, string, float, integer,etc” to the output screen.
So what ever we write between printf() inverted commas (" ") that will be printed on the output Screen

Comments

Write to Us