Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change name of data type in C

Tags:

c

Is it possible to change the name of the data type that you will be using in your code? Say, instead of defining "int a", you want to do "my_type a" after telling the compiler that "my_type" = "int". Thanks.

like image 990
user152169 Avatar asked Feb 01 '26 23:02

user152169


1 Answers

Yes, C supports this using a typedef declaration:

typedef int my_type;

my_type a;
like image 136
Greg Hewgill Avatar answered Feb 04 '26 01:02

Greg Hewgill



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!