结构体定义有问题
#include<stdio.h>
#include<stdlib.h>
typedef struct Node *PtrToNode;
struct Node {
int key;
PtrToNode next;
};
int main{
PtrToNode tmp,List= NULL;
int A[5]={123,23,43,546,54};
for (int i=0; i<5; i++) {
tmp = (PtrToNode)malloc(sizeof(struct Node));
tmp->key = A[i];
tmp->next = List;
List = tmp;
}
}
8 16 [Error] expected primary-expression before 'tmp'
查找了资料但是感觉这样定义没有什么问题