![]() |
In C, we use typedef to create aliases for already existing types. For structure, we can define a new name that can be used in place of the original struct name. In this article, we will learn how to create a typedef for a structure in C++. Use the typedef struct in CTo create an alias for a structure in C, we can use the typedef keyword typedef for a structure that provides the existing datatype with a new name. SyntaxFor defining the structure and creating a typedef simultaneously use: typedef struct StructName { For defining the Structure first, then creating a typedef use: struct StructName { C Program to Create an Alias Using typedef for a structThe below program demonstrates the use typedef keyword to create a typedef for a structure in C. C
Output
Student Information: Name: Ram Age: 20 GPA: 9.50 |
Reffered: https://www.geeksforgeeks.org
C Language |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 15 |