Author Dickson
#include<x.h>
- examples of preprocessor directives
<stdio.h> , <math.h> , <string.h>
This is an entry point to any C program
int main()
{
//statements
}
Datatype Name;
Datatype Name = Value;
const Datatype Name= Value;
#define Name Value
- Global constants have no semi-colon at the end of the line
Datatype Name[size];
Datatype Name[size] = {Value,value,Value};
Datatype Name(arg1,arg2);
- usually done below preprocessor directives and before int main() Function
Datatype Name(arg1,arg2){
//statements
}
printf("");
scanf("%d",&variable);
while(condition)
{
//statements
increment++;
}
do
{
//statements
}
while(condition)
executes the statements at least once before the condition is checked
for (i=0; i<ArraySize; i++)
{
//statements
}
- Break - exits loop completely
- Continue - Skips statements for current iteration before proceeding to the next iteration