শনিবার, ৬ জানুয়ারী, ২০১৮

Analyzing C Program Structure

Example of a Programme:

#include <stdio.h>
#include <conio.h>
void main(){
  clrscr();
  printf(“This is my first C program \n”);
  getch();
}

Header file

#include <stdio.h>
•C Pre-processor
•Lines beginning with # are processed by the pre-processor before the program is compiled
•This line tells the pre-processor to include the contents of the standard input output header file
•To compile library function printf(), it is required.

#include <conio.h>
•Required for clrscr() and getch().


main ( ) function

void main( )
•It is a part of every C program
•The parenthesis after main indicates that main is a program building block called a function
•C programs are composed of one or many functions like it but main is a must

Library function

clrscr();
•C library function.
•Clears the contents present in the screen.

printf(“This is my first C program \n”);
•C statement.
•Statements are always terminated with a semi-colon
•This statement has a library function called printf( )
•It takes a string inside of it within two quotation marks
•Whatever is in between them, will be printed on the screen
•The backslash (\) character is called Escape Character
•The escape sequence \n means new line

getch();
•Another C library function
•When the program compiles and provides an output, it waits for getting a character from the keyboard
•When it gets, it returns from the output screen to source code



C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations.

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন

  10:57 How to make a Bootable USB Flash for Windows 10 Operating System | পেন ড্রাইভে উইন্ডোজ লোড ✔️ 5 views 3 days ago 100% ...