1
所以,我有以下幾點:如何定義C Struct中變量的值?
struct semaphore{
int count; //or whatever value is needed
struct PCB *Sem_Queue;
};
struct semaphore Forks[5];
struct semaphore Doorman;
Doorman.count =4;
我要定數= 4的看門人,但與上面的代碼我得到一個語法錯誤。我究竟做錯了什麼?
在全局範圍內(函數外部)不能有語句(如'Doorman.count = 4;')。 –