typedef allows you to create an alias or nickname for an existing data type in C. You use the typedef keyword followed by the existing data type and the new alias name. For example, typedef int Intdata creates Intdata as an alias for the int data type that can be used anywhere an int is expected. The document also shows an example of using typedef to first create Intdata as an alias for int, then creating Integerdata as an alias for Intdata to demonstrate nesting typedefs.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
57 views2 pages
Typedef
typedef allows you to create an alias or nickname for an existing data type in C. You use the typedef keyword followed by the existing data type and the new alias name. For example, typedef int Intdata creates Intdata as an alias for the int data type that can be used anywhere an int is expected. The document also shows an example of using typedef to first create Intdata as an alias for int, then creating Integerdata as an alias for Intdata to demonstrate nesting typedefs.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Typedef
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 typedef datatype alias_name; Example of typedef #include<stdio.h> #include<conio.h>
typedef int Intdata; // Intdata
is alias name of int void main() clrscr(); { s=a+b; int a=10; printf("\n Sum:= %d",s); Integerdata b=20; getch(); typedef Intdata Integerdata; } // Integerdata is again alias name of Intdata Integerdata s;