✨ Jawaban Terbaik ✨
Unfortunately a process can’t allocate unspecified number of certain struct on stack.You have to use malloc to dynamically allocate memory which,of course, is less efficient compared with allocation on stack.
問題1:請問我能讓使用者輸入全班的人數後,再把使用者輸入的值設成陣列的大小嗎(第18行)
問題2:因為我有呼叫3函數,但這三個函數都有接收結構變數,我想把結構陣列設成全域都可使用,但因為不知道全班的人數,結構陣列的大小就無法得知,有什麼方式可以解決這個問題呢?
因為照片數量限制而沒辦法拍到完整的程式,希望能有高手能幫我解答^_^
✨ Jawaban Terbaik ✨
Unfortunately a process can’t allocate unspecified number of certain struct on stack.You have to use malloc to dynamically allocate memory which,of course, is less efficient compared with allocation on stack.
Pengguna yang melihat pertanyaan ini
juga melihat pertanyaan-pertanyaan ini 😉
Thank you~