Monday, August 17, 2020

4.1 Introduction to C Data Types

  • Whenever you create a variable, before that, the compiler tells you what kind of data you store in that variable. 
  • This gives the compiler the same memory allot from that of the memory of the computer.


/* A Integer type variable */ int age;



  • The statement given above tells the compiler that you are going to store a whole number (without a decimal) in age variable. 
  • The amount of memory required to store any whole number is equal to the compiler as it allot for this variable. Which is 2 bytes.
  • If there are no data types in a programming language, then there may be a lot of memory waste. 
  • When you need 2 bytes then you can waste 20 bytes. 
  • Therefore, for any type of data you can store, the maximum memory limit has already been defined for it.
Different C Data Types :

❖ C language supports 3 types of data types. These are also called primitive types.

❖ Integer Type
  • int
  • short int
  • long int
  •  signed int
  • unsign int
❖ Floating Point Type
  •  float
  • double
❖ Charcter Type
  • char
  • Void

No comments:

Post a Comment

Please do not any spam link in Comment Box