Data Types in C

Data Types in C
Slide Note
Embed
Share

In C programming, data types specify the type of data a variable can hold such as integer, floating, character, and more. This article covers the basic data types, memory sizes, keywords, and identifiers used in C programming. It discusses integer-based and floating-point based data types, supported in both signed and unsigned literals. The memory size ranges for different data types in a 32-bit architecture are also highlighted. Furthermore, it explains the importance of identifiers in representing various programming elements like variables, functions, arrays, and more in a C program.

  • Data Types
  • C Programming
  • Memory Sizes
  • Keywords
  • Identifiers

Uploaded on Feb 17, 2025 | 3 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Data Types in C A data type specifies the type of data that a variable can store such as integer, floating, character, etc.

  2. There are the following data types in C language. Types Data Types Basic Data Type int, char, float, double Derived Data Type array, pointer, structure, union Enumeration Data Type enum Void Data Type void

  3. Basic Data Types The basic data types are integer-based and floating-point based. C language supports both signed and unsigned literals. The memory size of the basic data types may change according to 32 or 64-bit operating system. Let's see the basic data types. Its size is given according to 32-bit architecture.

  4. Data Types Memory Size Range char 1 byte 128 to 127 signed char 1 byte 128 to 127 unsigned char 1 byte 0 to 255 short 2 byte 32,768 to 32,767 signed short 2 byte 32,768 to 32,767 unsigned short 2 byte 0 to 65,535 int 2 byte 32,768 to 32,767 signed int 2 byte 32,768 to 32,767 unsigned int 2 byte 0 to 65,535

  5. short int 2 byte 32,768 to 32,767 signed short int 2 byte 32,768 to 32,767 unsigned short int 2 byte 0 to 65,535 long int 4 byte -2,147,483,648 to 2,147,483,647 signed long int 4 byte -2,147,483,648 to 2,147,483,647 unsigned long int 4 byte 0 to 4,294,967,295 float 4 byte double 8 byte long double 10 byte

  6. Keywords in C A keyword is a reserved word. You cannot use it as a variable name, constant name, etc. There are only 32 reserved words (keywords) in the C language. A list of 32 keywords in the c language is given below: auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while

  7. C Identifiers C identifiers represent the name in the C program, for example, variables, functions, arrays, structures, unions, labels, etc. An identifier can be composed of letters such as uppercase, lowercase letters, underscore, digits, but the starting letter should be either an alphabet or an underscore. If the identifier is not used in the external linkage, then it is called as an internal identifier. If the identifier is used in the external linkage, then it is called as an external identifier. We can say that an identifier is a collection of alphanumeric characters that begins either with an alphabetical character or an underscore, which are used to represent various programming elements such as variables, functions, arrays, structures, unions, labels, etc. There are 52 alphabetical characters (uppercase and lowercase), underscore character, and ten numerical digits (0-9) that represent the identifiers. There is a total of 63 alphanumerical characters that represent the identifiers.

  8. Rules for constructing C identifiers The first character of an identifier should be either an alphabet or an underscore, and then it can be followed by any of the character, digit, or underscore. It should not begin with any numerical digit. In identifiers, both uppercase and lowercase letters are distinct. Therefore, we can say that identifiers are case sensitive. Commas or blank spaces cannot be specified within an identifier. Keywords cannot be represented as an identifier. The length of the identifiers should not be more than 31 characters. Identifiers should be written in such a way that it is meaningful, short, and easy to read.

More Related Content