Skip to main content

Datatypes

                       DATATYPES IN C

What is datatype ???
  • C data types are defined as the data storage format that a variable can store a data to perform a specific operation.
  • Data types are used to define a variable before to use in a program.
Following are the examples of some very common data types used in C:
  • 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.

DATA TYPEMEMORY (BYTES)RANGEFORMAT SPECIFIER
short int2-32,768 to 32,767%hd
unsigned short int20 to 65,535%hu
unsigned int40 to 4,294,967,295%u
int4-2,147,483,648 to 2,147,483,647%d
long int4-2,147,483,648 to 2,147,483,647%ld
unsigned long int40 to 4,294,967,295%lu
long long int8-(2^63) to (2^63)-1%lld
unsigned long long int80 to 18,446,744,073,709,551,615%llu
signed char1-128 to 127%c
unsigned char10 to 255%c
float4%f
double8%lf
long double

References...
www.geeksforgeeks.org

12%Lf













Comments

Popular posts from this blog

Basics of C with example

                          C   language                             C is a procedural programming language. It was initially developed by Dennis Ritchie and Ken Thompson in the year 1972 at AT and T bell lab of USA .  It was mainly developed as a system programming language to write an operating system. The main features of C language include low-level access to memory, a simple set of keywords, and clean style, these features make C language suitable for system programmings like an operating system or compiler development. It is mainly used to convert high level code into low level language code and vice versa. High level language code includes.........     A,B,C......                                           ...

Difference in C and C++ language

  Difference between C and C++ Language.. C                            C is procedure oriented programming (POP). In C programs are divided into small parts known as functions. Encapsulation,abstraction,Inheritance and polymorphism are not supported in C. Inline functions and virtual functions are not available in C. Function overloading and operator overloading are not possible in C. C uses scanf() and printf() functions for input/output. C uses malloc() and free() functions for dynamic memory allocation and dealloaction. C does not support exception handling. Filename extension is . Follows top down approach in program design. Example...1.Program to add two numbers. #include <stdio.h> #include<conio.h> void main() {    int a,b,c;   printf("Enter two numbers :");   scanf("%d,%d",&a,&b);   c=a+b;   printf("Addition is : %d",c...