C typedef keyword

Using typedef, we can create an user defined name for existing datatype.
Generally using typedef, we can create an alias names.


typedef datatype user_define_name;


typedef int myint;
int main()
int a=10;
myint b=20;
typedef myint smallint;
printf(“\n Sum of a and b = %d”, s);
return 0;

Output: 30

  • In the above program all properties of integer will be applied to myint also.
  • Smallint is an alias name to existing user-defined name called myint.
Powered by k2schools