Tuesday, 3 September 2013

Understanding program elements

c and c++ tutorials // online learning spot
The elements we used are listed below :
  1. #
  2. include
  3. < >
  4. stdio.h
  5. main()
  6. { }
  7. printf("Hi this is my First C program")
  8. ;
  • # is called pre-processor which does preliminary work  before executing your code. It is like making some arrangements to let compiler understand your code.
  • include is a folder which contains some pre-written codes called header files. So both #include combines to form a directive which reads a file in folder and pre-processes it.
  • stdio.h it is a header file which contains codes for standard input output functions i.e. for I/O operations that we don't need to bother. To make I/O easy for us this header files provides us some names that we can directly write in our program and have our task completed. These names are called functions, they contain a procedure written in header file.
  • < > in combination used to bind header file name.
  • main() is a function whose procedure is given by programmer. Like we have given printf("Hi this is my First C program"); 
  • { } is used to bind the statements and tell their identity i.e. under which element these statements are binded
  • printf() is also a function, it is described in stdio.h header file. To use this function all you have to do is that just put what ever you want to print on screen inside ( ) in between " ", it will print it same as you mention.
  • ; is a semicolon that terminates any statement in program. Like we used it at the end of printf().



<<Back        Next>> 

No comments:

Post a Comment