CS *_*ent 3 c printf
如果我有以下代码,那么句子在哪里sprintf存储?
sprintf
它是存储在提供的100个字节malloc中还是存储在其他地方,store指针现在指向新位置?
malloc
store
char *store = malloc(100); int num = 77; sprintf(store, "the number was: %d", num);
Mur*_*nik 5
sprintf不会自己分配内存 - 它只是将输入存储在先前分配的缓冲区中.在您的情况下,这确实是您通过malloc调用分配的缓冲区.
归档时间:
12 年,1 月 前
查看次数:
152 次
最近记录: