How To Print Name in C Language
It is very easy to print a name in C. All program has a header file, firstly you have to include the header file in the top of the program i.e #include<stdio.h>, this is a header file there are different types of header file in c compiler like #include<stdiolib.h>, #include<string.h>, we include them as per our requirement in this case we include the ''#include<stdio.h> '',
Next thing we have to do is create the main function. Every C program must have a main function it is actually the program starter. You should implement the main function just below the header file.
Just like the following code.
#include<stdio.h>
void main( )
{ this is body of the main function }
In the above code here ' void main( ) ' is the main function declaration where void is denoted the return type of the main function. If the main function returns an integer value then we int main() instead, In this case, we are using void return type that means our main function return nothing.
Now in the main function,the curly basis is used for the body of the main function. Here we write code for the function.
#include<stdio.h>
void main( )
{
printf(" Basic Tech Knowledge") ;
}
Here we have used the printf() function it is a compiler default function you can use this function to print anything you want to print.
If we run the above code in C then we will get the output as below.
Basic Tech Knowledge
Great, Now you know how to print a name in C.
0 Comments