Skip to main content

Basic of c language

The general syntax of c language is-
#include <stdio.h>
int main()
{
   
}

Firstly we should know about the data type

There are several data type

1.int
Int is used for integer variable
2.char
Char is used for char value
3.float -
Float is used for decimal value
Basically they define what type of data .And then do operation on it.
Variables -
Variable is a word that store value.
Header file-
For example-
#include <stdio.h>
It means that what type of operation
We do and that operation is define in that header file

Terminating semicolons-

; Is mean that statement is end.
Int main( )
Is should be added in every c program.
Size of data type-
TypeStorage sizeValue range
char1 byte-128 to 127 or 0 to 255
unsigned char1 byte0 to 255
signed char1 byte-128 to 127
int2 or 4 bytes-32,768 to 32,767 or -2,147,483,648 to 2,147,483,647
unsigned int2 or 4 bytes0 to 65,535 or 0 to 4,294,967,295
short2 bytes-32,768 to 32,767
unsigned short2 bytes0 to 65,535
long4 bytes-2,147,483,648 to 2,147,483,647
unsigned long4 bytes0 to 4,294,967,295
Keywords-
Keywords is that word whose meaning is already define in c .


Keywords in C Programming

Comments

Popular posts from this blog

solution of TRICOUNT - Counting Triangles on spoj

  TRICOUNT - Counting Triangles solution- #include<stdio.h> int main() {     int t;     scanf("%d",&t);     while(t--)     {         long long unsigned num,sum;         scanf("%llu",&num);         if(num%2==0)         sum=(num*(num+2)*((2*num)+1))/8;         else         sum=((num*(num+2)*((2*num)+1))-1)/8;         printf("%llu\n",sum);     }     return 0; }

solution of PRIME1 - Prime Generator on spoj

PRIME1 - Prime Generator solution- #include<stdio.h> #include<math.h> int main() {int t; long long int l,h,i,flag; scanf("%d",&t); while(t--) { scanf("%lld%lld",&l,&h); while(l<=h) { flag=0; for(i=2;i<=sqrt(l);i++) { if(l%i==0) { flag=1;     break; } } if(flag==0) { if(l!=1) printf("%lld\n",l); } l++; } printf("\n"); } return 0; }