The ones who are crazy enough to think they can change the world are the ones who do.
- Steve Jobs

C Basic Program

Basic Program

Here we starts with very basic C program

How Interpreter Works
basicprogram.c
#include <stdio.h> //header file section
int main() //main section
{
printf("I will display "); /*Output statement*/
return 0; /*Program ends here*/
}
  • I will display

Header File Section

C contains many inbuilt functions which are all predefined by its appropriated header files. Here we used printf() inbuilt function which is defined in stdio.h header files or otherwise said to be library. The file should be included by using #include directive e.g.) #include<stdio.h>.

Main Section

Every C program must contain main() function which tells the compiler that the program starts from here. Empty paranthesis must after every main in C programming. main function cannot have any parameters.

Executable Section

Executable section contains single (or) set of statement for example printf is an executable statement.

8 Programming Rules In C

  • Rule 1: All statement should be written in lowercase letters.
  • Rule 2: Uppercase letter can be used only for symbolic constants.
  • Rule 3: Blank spaces may be inserted between the words. This improves the readability of statements.
  • Rule 4: Blank spaces should not be allowed while declaring variables, constants, keyword, function.
  • Rule 5: Programmer can write the statement anywhere between the "2 braces".
  • Rule 6: Programmer can write one or more statement in one line, separating that by semicolon (;).
  • Rule 7: Opening and closing "braces" must be balanced.
  • Rule 8: Program must contain a main function.

Report Us

We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.

Report