Mohit Bajoria
Open source lover!
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. - Alan Turing
Hello World!
#include<stdio.h>
void main(){
printf("Hello World!");
}What is printf?
Its a function to print output.
What is function?
Functions
A function is a group of statements that together perform a task.
#include<stdio.h>
It imports the stdio.h header file from library.
stdio.h header file
A file in C library that contains functions related to standard input and output.
void main()
main() function is the entry point of a C program from where the execution begins.
The curly braces {...}
They represent the start and end point, i.e. the scope of the lines written inside them.
Questions
Lets add two numbers
#include<stdio.h>
void main(){
int a,b,c;
a = 4;
b = 7;
c = a+b;
}Datatypes
The data storage format that a variable can store a data to perform a specific operation.
Some of the datatypes commonly used
Variables
Variables are simply names used to refer to some location in memory – a location that holds a value with which we are working.
Arithmetic Operators
The operators which perform some arithmetic operations like adding, subtracting, multiplying etc.
Basic Arithmetic Operators
Be careful while dividing integers.
Type Specifiers
Type specifiers defines the type of data like integer, float, char etc. to be printed on standard output.
How to print an Integer
#include<stdio.h>
void main()
{
int a=3;
printf("Value of a is %d",a);
}By Mohit Bajoria