Data types in C

Data types in C

In C programming language, data types specify the type of data to be declared in the C program. In which the created program in C programming stores variable values. Each C programming data type has various specific features. Such as the size of the data type used as a variable and the range of their default storage values. Here are some default data types in C language. Which includes integer, float, char, double, long double data type etc.

Data types in C

Default Data Type in C Programming.

  • Character – Data type (1 byte) is used to store text value.
  • int – Integer data type (usually 2 or 4 bytes) is used to store integer decimal values.
  • Small – Small integer data type (usually 2 bytes) is the storage value.
  • Long – Long integer data type (usually 4 bytes) is the storage value.
  • Long data type – Very long integer (usually 8 bytes) is the default variable storage. Floating-point data type.
  • Float – Single-precision floating-point number (usually 4 bytes) is the default variable storage.
  • Double data type – Double-precision floating-point number (usually 8 bytes) is the variable storage value.
  • Long double data type – Extended precision floating-point number (size varies).
  • Void data type – Indicates the absence of zero storage value. Used in array or C programming function programs. Which do not return any type of program data value at the end of program execution,

Derived data type.

  • Array – As C language generic pointer data type, In derived C language data type, Array – A collection of homogenous similar program data variable elements in C programming language.
  • C Pointers – In C program, pointer variables are variables that store memory addresses of any declared data type.
  • C Structure – In C language, there are structured user-defined data types. Which group different structure program data variable value types of data in a single format.
  • Union – In C language, union data type is similar to structure data type. But in union, the declared data types share the same memory space.
  • Enumeration – Enumeration is also a user defined C language data type. Which stores different data type values ​​named user-defined data type values.

C Language Modifiers.

  • Signed – Represents positive and negative integer storage in C language program.
  • Unsigned – Represents non-negative numbers values ​​in C language program.
  • Short – Stores short data type in C language program.
  • Long – Stores long data type value in C language program.

Variable declaration in c.

char text = ‘T’;

int number = 9;

float temp = 98.6;

double pi_value = 3.14159;

void *ptr1 = NULL;

Size and Range.

In C language the size and range of declared types may vary depending on the program compiler and architecture. If you want to know the size of C program data type in bytes then you can find the default variable data storage value using sizeof() operator.

Choosing different data types in C language based on the requirement.

  • Always use int data format for integer data type unless there are specific programming project size requirements.
  • If you want float number data type for higher precision then you can use double data type for floating-point numbers.
  • For single character use char character data type.
  • Always keep in mind the memory usage and range requirements of the data type variable while choosing data types in C language.