Learn C Programming in 3 days ( First C program)

How to create variables in C Program

Before proceeding, we should know some rules to create a variables

Not start with number ----- 2cat

Not contain arithmetic operators -----A+B  

Not contain punctuation -------- %#@

Not contain any spaces ------- no book

Not contain any of c keyword -----  static



How to type C variable (syntax)

data-type variable name;

For multiple variable (syntax)

data-type variable 1, variable 2, variable 3;

Data types


char --- hold one character,a single byte----- A
int----- integer whole number----- 2, 3, 4, 5
float------ upto 6 decimal place, floating point number------4.3455, 5.345678 
double------ floating point number, upto 10 decimal place------- 5.1234567784,0.0123456355

How to write variable in a program 


#include<iostream.h>
#inlcude<stdio.h>
int main()
{
int no1,no2;                                 /* create variable no1, no2 in int, character in char and 
char character;                                    decimal in float */
float decimal=9.2;                   
printf("variables no1, no2, character, decimal are created");
getchar();
return 0;

}







    

  

Comments