Typedef

Navigation:  Programming language SQC > Language elements > Variables >

Typedef

Previous pageReturn to chapter overviewNext page

The typedef declaration provides a way to declare an identifier as a type alias,

to be used to replace a possibly complex type name

 

Example:

 

typedef struct 

{

   char name[50];

   int age;

} person;

 

void main()

{

 

    person 

      lisa;

      

    lisa.age = 30;

    strcpy(lisa.name, "Lisa Taylor");

 

    printf("Person %s is %d years old \n",lisa.name, lisa.age);    

          

}

 

Output:

 

  Person Lisa Taylor is 30 years old