C ++構造の文字ポインタメンバーを割り当てることができません

struct PCB
{
    
    
    char *Name; //进程名
    PCB* next;  //指针
    int arrivalTime;//到达时间
    int runTime;//估计运行时间(剩余运行时间)
    char state;//状态(P为未完成态,C为执行完成态)
}*headPointer;//循环队列头
PCB* inPCB; 
pcbQueue = (PCB*)malloc(sizeof(PCB));
cin >> inPCB->Name;

失敗!

struct PCB
{
    
    
    char Name[20]; //进程名
    PCB* next;  //指针
    int arrivalTime;//到达时间
    int runTime;//估计运行时间(剩余运行时间)
    char state;//状态(P为未完成态,C为执行完成态)
}*headPointer;//循环队列头
PCB* inPCB; 
pcbQueue = (PCB*)malloc(sizeof(PCB));
cin >> inPCB->Name;

成功!



どうしてこれなの!

おすすめ

転載: blog.csdn.net/weixin_43655282/article/details/107057892