Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私には機能があります
int*AllocatedMemory(int n){ int*p=malloc(n*sizeof(int)); return p; }
割り当てられたメモリは、関数を離れた後にスコープを失い、解放されますか?
いいえ。割り当てられたメモリmallocはスコープとは関係がなく、解放する必要がありますfree(またはプログラムの終了時に解放されます)。
malloc
free