Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use the typedef keyword in C language

Shulou Source: shulou.com Published: 2022-05-31 10:56:06 09月27日 Update

In this article, the editor introduces in detail "how to use the typedef keyword in the c language". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to use the typedef keyword in the c language" can help you solve your doubts.

1. The typedef keyword can give the type a new name.

2. By convention, uppercase letters are defined to remind users that type names are symbolic abbreviations, but lowercase letters can also be used.

3. You can also use typedef to give a new name to a user-customized data type.

Example

# include # include typedef struct Books {char title [50]; char author [50]; char subject [100]; int book_id;} Book; int main () {Book book; strcpy (book.title, "C tutorial"); strcpy (book.author, "Nowcoder"); strcpy (book.subject, "programming language"); book.book_id = 12345; printf ("Book title:% s\ n", book.title) Printf ("book author:% s\ n", book.author); printf ("book category:% s\ n", book.subject); printf ("book ID:% d\ n", book.book_id); return 0 } after reading this, the article "how to use typedef keywords in c language" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, welcome to follow the industry information channel.

Tags: Keywords keywords language article type content name letter user proper author name uppercase uppercase instance lowercase ideas conventions tutorials data Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Linux Shulou Technology Apple Shulou Tech Info