What is modifier in C and different types of modifiers

What is modifier in C and different types of modifiers

Modifiers are keywords in c which changes the meaning of basic data type in c. It specifies the amount of memory space to be allocated for a variable. Modifiers are prefixed with basic data types to modify the memory allocated for a variable. There are five data type modifiers in C Programming Language:

  • long
  • short
  • signed
  • unsigned
  • long long

What is the difference between Character, Integer, Float and Double data types.

  • Character : Character data type is used to store a character. A variable of character data type allocated only one byte of memory and can store only one character. Keyword char is used to declare variables of type character. Range of character(char) data type is -128 to 127.
    For Example: char ch = ‘A’;
  • Integer : Integer data type is used to store a value of numeric type. Keyword int is used to declare variables of integer type. Memory size of a variable of integer data type is dependent on Operating System.For example size of an integer data type in a 32 bit computer is 4 bytes whereas size of integer data type in 16 bit computer is 2 bytes.
    For Example: int count = 10;
  • Float : Floating point data type is used to store a value of decimal values. Memory size of a variable of floating point data type is dependent on Operating System. Keyword float is used to declare variables of floating data type. For example size of an floating point data type in a 16 bit computer is 4 bytes.
    For Example: float rate = 5.6;
  • Double : Double data type is similar to floating data type except it provides up-to ten digit of precision and occupies eight bytes of memory.
    For Example: double d = 11676.2435676542;

What is constant in C and Different Types of Constants.

Constants in C refer to fixed values that program cannot change during the time of execution. Constants are also known as literals. A constant can be of any data type like character constant, integer constant, string constant etc.

For Example : ‘A’, 1234, 123.5, “TechCrashCourse”

C Constants are like normal variables, the only difference is, their values cannot be changed by the program once they are defined.

Types of Constants in C

  • Integer constants
  • Character Constants
  • Backslash Character Constants
  • Integer Constants
  • Floating Point Constants
  • String Constants