
To write a Program to Print your Name in C, we have the printf() function in C Language.
You just have to write your Name inside the printf() function and you will be able to Print or Display your Name.
![Write a Program to Display your Name in C [Updated 2026]](/_next/image?url=%2Fimages%2Ftutorials%2Fc-programming-printing-your-name-using-c-program.png&w=828&q=75)
1) First Open Your Code-Editor/IDE
(For Example Code::Blocks / CLion / Visual Studio)
2) Create a New File And Save.
(for example myname.c)
3) Write the code As shown Above.
4) Save and Run your C Program.
(You will need a Compiler that can Compile and Run your program written in C language. for example gcc/Clang/MSVC)
By using #include
So #include going to include
std: standard
io: Input Output
.h: Header file extension.
Without this header file, printf() worn't work.
Here main() is our Main function, where we are using void because this function is not going to return any value.
We can also use int main() or char main() depending upon the type of value we are going to return.
By using printf(), we are Printing our Name or a String.
Where printf() function will take the value as an Input and Display it as an Output.
In order to Input a Name and Display it in C, we need to use two very Important C Functions,
printf() and scanf().
Where by using printf() function we will print things like "Write your name", to tell our users to Enter their name.
Then by using scanf() function we will store their entered name inside a C Variable myname.
By using scanf("%s", &myname), we are telling our compiler that we are expecting a String "%s" value and we want to store that String value inside our variable "&myname".
At the end we will Display/Print the Name using the printf() funtion.
Here we are using "%s" as our String Placeholder and printf() function will print our myname variable's value there.
To print your Name and Address we can use printf() Function.
Just write your name inside The C Print Function [ printf("Name and Address"); ]
and you are DONE.
To Print your name at the center of the screen.
We have to use C Languageās gotoxy() function.
Where we need to provide X and Y digits to Perfectly align our Name at the Center of the Screen.
If you have Multiple Names Stored inside an Array, then you can Loop through it and Print every name One-By-One.
In the Example above, we are using char mynames[3][20] to create an Array in C.
Where are specifying the Array and Character Length.
Where [3][20] means that our Array will include 3 Values with a Max 20 Character Length.
To print Name and Age we have to deal with Characters and Integer values. Where for storing Character Values we have CHAR data type and for integers with have INT data type. And for address/format specifier we have %s for String and %d for Integers.