Use of typedef

typedef is a user-defined synonym for an existing type. To create a synonym for a type, you use the keyword typedef followed by the name of the type and the new name you are defining.


E.g. typedef unsigned int uInt; 


Here uInt will be synonym for type unsigned int. 


The following line of code actually produces an int* which is and an int (not an int*) which is y. That is, the ‘*’ binds to the right, not the left.


int * x, y; 


However, if you use a typedef:



typedef int* intPtr;
intPtr x, y;
                  
Then both x and y are of type int*.

Comments

Popular posts from this blog

How to flash CWM Recovery to Samsung Galaxy SL( GT-I9003) using Odin

How to boot Samsung Galaxy SL( GT-I9003) in recovery mode

Exception handling with RestTemplate