Typedef
typedef is used to redefine the existing data type names. Basically, it is used to provide new names to the existing data types. The “typedef” keyword is used for this purpose;
Syntax
typedef existing_name alias_name;
Example
C
// C Code to implement Typedef #include <stdio.h> typedef char Company; int main() { Company* name = "w3wiki" ; printf ( "Best Tutorials on: %s \n" , name); return 0; } |
Output
Best Tutorials on: w3wiki
User-Defined Data Types In C
Data Types are the types of data that can be stored in memory using a programming language. Basically, data types are used to indicate the type of data that a variable can store. These data types require different amounts of memory and there are particular operations that can be performed on them. These data types can be broadly classified into three types:
- Primitive Data Types
- Derived Types
- User Defined Data Types
In this article, will discuss the User-Defined Data Type.
Contact Us