Posts

Array

An array is a collection of fixed number of values of a single type. For example: if you want to store 100 integers in sequence, you can create an array for it. Arrays are of two types: One-dimensional arrays Multidimensional arrays

Repetition

Repetition in c used to makes shapes, search, sort and many kind of things.Example : #include <stdio.h> void main() {       int j;       j = -4;       for( ; j <= 0 ; )       {             printf("%d\n", j);             j = j + 1;       } } Output : -4 -3 -2 -1 0

Selection

The statement following the control expression is executed if the value of the control expression is true (nonzero). An if statement can be written with an optional else clause that is executed if the control expression is false (0). Example : #include<stdio.h> int main(){  int a=2;    if (a%2==0){ printf ("even"); } else { printf ("Odd"); } return 0; } The output is even why because the computer will do the aritmatics operation of 2%2 =0 and the statement for 2%2 =0 is even so the output is even.

Operators

C Arithmetic Operators An arithmetic operator performs mathematical operations such as addition, subtraction, division and multiplication on numerical values (constants and variables). addition (+) = addition or unary plus substraction (-) = subtraction or unary minus multiplication (*) = to multiply int division (/) = to divide int modulo (%) = remainder after division

Data type

there are 4 most common data type that used on c programming : - char: The most basic data type in C. It stores a single character and requires a single byte of memory in almost all compilers. - int: As the name suggests, an int variable is used to store an integer. - float: It is used to store decimal numbers (numbers with floating point value) with single precision. - double: It is used to store decimal numbers (numbers with floating point value) with double precision.