ma'am if only we have to use the short name of data type than we can directly used the name od the type declared then why we using typedef only to take the short name . and in alias don't get output of 24 for both ?
Typedef is not only used to give short names but also allows us to give a meaningful name to the existing data type which helps other users to understand the program more quickly. Ex: unsigned int addr; .......//your code Unsigned int wdata; ........//your code ....... //If you use typedef,this is how it looks: typedef unsigned int uint; uint addr; uint wdata; ........ uint rdata,en; If you want to change the datatype of the above u can just change in 1st line. U don't hv to change everywhere. And typedef construct is also used for forward declaration. (You can go through typedef classes concept).
ma'am if only we have to use the short name of data type than we can directly used the name od the type declared then why we using typedef only to take the short name . and in alias don't get output of 24 for both ?
Typedef is not only used to give short names but also allows us to give a meaningful name to the existing data type which helps other users to understand the program more quickly.
Ex: unsigned int addr;
.......//your code
Unsigned int wdata;
........//your code
.......
//If you use typedef,this is how it looks:
typedef unsigned int uint;
uint addr;
uint wdata;
........
uint rdata,en;
If you want to change the datatype of the above u can just change in 1st line. U don't hv to change everywhere.
And typedef construct is also used for forward declaration.
(You can go through typedef classes concept).
I am getting x for both a and b instead of 24 ?
Use Synopsys VCS simulator