Professional Documents
Culture Documents
Typedef in C
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 analias
name (nickname).
#include<stdio.h>
#include<conio.h>
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;
clrscr();
s=a+b;
printf("\n Sum:= %d",s);
getch();
}
Output
Sum: 20
Code Explanation
In above program Intdata is an user defined name or alias name for an integer data
type.
http://www.tutorial4us.com/cprogramming/c-typedef