typedef basis of the data structure and algorithm usage

Alias ​​data type

. 1 #include <stdio.h>
 2  
. 3 typedef int I; // to multiple re-int a name, i is equivalent to int 
. 4  
. 5 typedef struct Student {
 . 6      int SID;
 . 7      char Sex;
 . 8 } ST; // struct student again to take on more of a name ST, the following struct student places to be useful can be used instead of the ST 
. 9  
10  int main () {
 . 11      int a = 10 ; // equivalent to 10 = IA; 
12 is      struct Student ST ; // equivalent to ST ST; 
13 is      struct Student * PS; //PS * equivalent to ST; 
14      return  0 ;
 15 }

 

. 1 #include <stdio.h>
 2  
. 3 typedef struct Student {
 . 4      int SID;
 . 5      char Sex;
 . 6      } * the PST, the STU; // separated by commas, PST equivalent to struct student *, STU Student Representative struct 
. 7  
. 8  int main () {
 . 9      the STU ST;   // struct Student ST 
10      the PST PS = & ST;   // struct PS * = Student & ST; 
. 11      return  0 ;
 12 is }

 

Guess you like

Origin www.cnblogs.com/sunbr/p/11318582.html