syntax :
typedef <current_name> <new_name>
example:
typedef struct {
int SqBiTNode[MAX_SIZE];
int ElemNum;
}SqBiTree;
The code first declares a struct with no name, and a typedef alias for that struct. The alias name is just SqBiTree!
There is an error i got in code:
#include <iostream>
using namespace std;
#define MAX_SIZE 100
typedef struct {
int SqBiTNode[MAX_SIZE];
int ElemNum;
}SqBiTree;
~~struct~~ SqBiTree* createTree(int array[], int N)
{
SqBiTree* tree = (SqBiTree*)malloc(sizeof(~~SqBiTree~~ ));
}
int main()
{
int array[] = {40, 25, 60,-1, 30,-1, 80, -1, -1, 27};
int N = sizeof(array) / sizeof(array[0]);
}
i got error “incomplete type is not allowed”
after i deleted struct keyword, it works well.