Typedef in C

Google Advertisements

Prev Tutorial Next Tutorial

Typedef in C

The C programming language provides a keyword called typedef, by using this keyword you can create a user defined name for existing data type. Generally typedef are use to create an alias name (nickname).

Declaration of typedef

Syntax of Typedef in C

typedef  datatype alias_name;

Example of Typedef in C

typedef  int Intdata;

Example of typedef


typedef int Intdata; // Intdata is alias name of int
void main()
int a=10;
Integerdata b=20;
typedef Intdata Integerdata; // Integerdata is again alias name of Intdata
Integerdata s;
printf("\n Sum:= %d",s);


Sum: 20

Code Explanation

  • In above program Intdata is an user defined name or alias name for an integer data type.
  • All properties of the integer will be applied on Intdata also.
  • Integerdata is an alias name to existing user defined name called Intdata.

Note: By using typedef only we can create the alias name and it is under control of compiler.

You can in another example, here myint is alias name for integer data and again smallint is alias name for myint.

typedef in c
Prev Tutorial Next Tutorial

Google Advertisements

Buy This Ad Space @$50 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 8076671483

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Cloud computing is the on demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. Cloud Computing Tutorial

College Projects Related to Java, AWT, C Projects for College, C++ Projects for College, Android Projects. Download Java C C++ Projects

Download Projects

Adsense Advertisements

Buy This ads Space 8076671483

Buy This Ad Space @$120 per Month, Ad Size 300X600 Contact on: hitesh.xc@gmail.com or 8076671483 Try this Keyword C++ Programs