How to write a simple hello code in C

How to write a simple hello code in C

Ashish Pandey:21/11/2019 how to write a program in C language? this question has arise in every beginner's , as we know that C is simplest and easy language in coding to learn but for beginners , it is very defficult language because they don't know what is C language. 
Q. Write a C program to execute HELLO word .

  Step 1.             #include<stdio.h>

 Step2.                int main()

 Step3.      {

 Step4.       printf("\n HELLO");

 Step5.      }
                Now i am discusing how to i  write this  program , as we know that this is a simple C program which execute "HELLO" word .

 : Here ‘#’ is a preprocessor directive which means something has to be done by the compiler before processing the compilation.Now the question is what is to be done?
include : Now ‘include’ after ‘#’ instructs the compiler to include a file before processing.Now the question is which file is to be included & where is it present?
<> : When compiler encounters a filename enclosed within ‘<filename >’ , then it looks     for the filename at predefined standard paths. eg : /usr/local/sbin:/usr/local/bin:/ …. etc . Standard paths are set in environmental variable : PATH. If the filename is enclosed within “filename” ,it means that compiler should look for the filename in the current path first before searching it at the standard paths.
stdio.h : This is the filename enclosed within ‘<>’ which means the compiler will look for a filename ‘stdio.h’ at the standard paths and include it(copy its contents)in the current file before processing anything amongst the compilation steps.
main(): is a mandatory function in C programs. It defines the entry point of the programs. int is the return type of the function. main() returns to the Operating System. main() returns 0 on success and 1 on failure.
Printf(): it is used for printing the hello word .
\n: it is used for getting output in new line
            I hope this will usefull for you!

Post a Comment