سلام .
کلمه ی typedef رو اگه میخوای type های دیگه ای ای همین ساختار داشته باشی باید بزاری .
مثلا :
#include <iostream>
#include <stdlib.h>
#include <string.h>
typedef struct __STRUCT
{
int x,y,z;
}STRUCT,*PSTRUCT;
using namespace std;
int main ()
{
STRUCT a;
PSTRUCT b;
b = &a;
return 0;
}
کاربرد دیگش هم توی C هست . چون توی C برای تعریف یک شی از ساختار باید کلمه ی struct رو قبلش بنویسی . با typedef میشه بدون نیاز به نوشتن کلمه ی struct این کار رو کرد :
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct STRUCT
{
int x,y,z;
};
struct STRUCT a;
struct STRUCT*b;
typedef struct STRUCT2
{
int x,y,z;
}STRUCT2;
STRUCT2 c;
STRUCT2*d;
int main()
{
b = &a;
d = &c;
return 0;
}