What is the difference between typedef and define in C language
This article mainly introduces "what is the difference between typedef and define in c language". In daily operation, I believe that many people have doubts about the difference between typedef and define in c language. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the question of "what is the difference between typedef and define in c language?" Next, please follow the editor to study!
1. Typedef is limited to defining symbolic names for types. Define can define aliases not only for types, but also for numeric values.
For example, 1 can be defined as ONE.
2. The typedef is interpreted by the compiler, and the define statement is processed by the precompiler.
Example
# include # define TRUE 1#define FALSE 0 int main () {printf ("value of TRUE:% d\ n", TRUE); printf ("value of FALSE:% d\ n", FALSE); return 0;} at this point, the study on "what is the difference between typedef and define in c language" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!