-->





Translate

Writing first Hello World program and detail explanation

2 comments

1.What is preprocessor directory?


  • It always starts with # symbol it tells the compiler what kind of header file include in this program to execute it. It gives access to compiler to access the libraries which contain definition of standard library functions and some specific word.
  • where in program iostream.h and conio.h are  header files having extension of .h  header files contains definition of some specific words e.g iostream.h contain defination of "cout<<" and conio.h contains definition of clrscr();  and getch();

Note:If we don't include iostream.h  and conio.h then compiler will show error because compiler will unable to find the definition of word which header file tells.
2. main()

  • It indicates the beginning of the actual body of program where open brace indicates beginning of body and closing brace shows closing of body of program.
  • Every C program have main function without it compiler generates error and program cannot run.

3. Delimiters
What are delimiters?

  • These are the braces which indicates the beginning and ending  of main() body
  • {indicates beginning
  • } indicates ending

4. cout<<
The word cout followed by << like that  cout<< is use to show output in C programming
5. Statement terminator

  • Every C statement ends with statement terminator called semicolon symbol; without it compiler generates error and program cannot run.


6. clrscr();

  • It is a standard library function.Why we use it?
  • we use it to clear the previous output of program.
  • For example:if we execute our program again and again without writing clrscr();
  • Then compiler will show the output of current program that executed and also display the previous output of program.

7. getch();

  • It is also a standard library function why we use it?
  • It is use to hold the output or output screen if we
  • Do not use it then we are unable to see our programs output.
  • Note: It is possible that in the start beginner  face some  difficulties and unable to understand the above explanation but beginner should remember this general method of writing a C program when he or she will move forward confusions will clear.

2 comments:

  1. ould u pls upload a program for linear search, binary search, bubble sort methods used in an array in c++.
    pls do put a logic after the program

    ReplyDelete
    Replies
    1. Here is Linear Search in C++ array Example Code With Logic Explanation
      Linear Search In C++ Code

      Delete