Knowledge Walls
Venkatesan
Hyderabad, Andhra Pradesh, India
Passcode:
Introduction [cont'd]
Input Output Functions [cont'd]
Structures and Unions [cont'd]
# Preprocessor [cont'd]
Datatypes & Variables in Introduction of Programming in C
1915 Views
Define C datatype? 
Datatype is used to specify and allocate memory for variables. Datatype size is differ from machine to machine. C supports int, float, char and double datatypes. limits.h has all size range details for datatypes.
Define C variables? 
Variable is an identifier or user specified name stores a data value. Constant variables are unchanged during program execution.
Datatype details 
Datatype Usage Memory size Limits
int stores rounded decimal values 2 bytes 32, 768 to 32, 767
float stores decimal values 4 bytes 3.4e-38 to 3.4e+38
char stores a character 1 byte -128 to 127
double stores high ranges of decimal values 8 bytes 1.7e-308 to 1.7e+308
Variable declration Syntax 
Datatype [variable name 1],[variable name 2]...[variable name n];

Usage
int a,b,c;


Datatype variable-name = initial-value;
Usage
int a = 10;
Program
#include
void main(){
   int a,b,c;
   a = 10;
   b = 20;
   c = a + b;
   printf("C=%d",c);
}
Output 
C=30
Previous Topics
Previous lessons of current book.
Introduction of Programming in C
Introduction of Programming in C
Best Lessons of "Programming in C"
Top lessons which are viewed more times.
Structures and Unions of Programming in C
Input Output Functions of Programming in C
Structures and Unions of Programming in C
Sub Lessons
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details