March 27, 2024
Keywords and Datatypes in C language
TechTechInfo.com » Keywords and Datatypes in C language

Keywords and Datatypes in C language

Keyword and datatypes
Keyword and datatypes

What is a keyword?

Keywords are the reserved word’s in a programming language. These are predefined in a programming language and has different mean for the compiler. These keywords can’t be used as a user-defined program identifier.

List of keyword defined in the c language

 

autodoubleintstruct
breakelselongswitch
caseenumregistertypedef
charexternreturnunion
continueforsignedvoid
doifstaticwhile
defaultgotosizeofvolatile
constfloatshortunsigned
Example :

#include <stdio.h>      
int main() {
  int a;
  double x;
  return 0;
}

What is Data Type?

  • Data types are used to define the variable and function in a program to store the value of different sizes or types.
  • The data type is useful to save memory space.
  • We have different datatype to store the different sizes of data. 

List of dataTypes with respect to their sizes

 

TypeSize (bytes)Format Specifier
intat least 2, usually 4%d, %i
char1%c
float4%f
double8%lf
short int2 usually%hd
unsigned intat least 2, usually 4%u
long intat least 4, usually 8%ld, %li
long long intat least 8%lld, %lli
unsigned long intat least 4%lu
unsigned long long intat least 8%llu
signed char1%c
unsigned char1%c
long do0 Comments in moderationubleat least 10, usually 12 or 16%Lf

Example:

#include <stdio.h>      
int main() {
  int a;
  printf("size of int= %d bytes\n", sizeof(a));
  return 0;
}

Join the discussion

Translate »