How to write an alias in C using typedef

typedef keyword in C can be used to write an alias to a type(int, long, long long int, struct, etc.). Let’s see how we can do that

We gave int an alias/ new name of myint, which allowed us to declare a variable n like so:
myint n;
The above line is the same as writing
int n;

Note: Once we give type an alias/ name e.g. in the above case, myint, we can’t use this alias as our variable name – makes sense? we don’t use keywords as variable names

Leave a Reply