0
Struct標籤和指向Struct的指針有什麼區別?是相同的?或者這是我的例子,是obj和* var兩個不同的內存位置?結構標記和指向結構的指針是否相同?
#include <stdio.h>
#include <stdlib.h>
struct alloc {
char data;
};
int main(int argc, char** argv) {
struct alloc obj;
struct alloc *var = calloc(5,sizeof(struct alloc));
(var -> data) = 'P';
printf("Data:%d",obj.data);
return (EXIT_SUCCESS);
}
[靜態內存分配和動態內存分配之間的差異]的可能重複(https://stackoverflow.com/questions/8385322/difference-between-static-memory-allocation-and-dynamic-memory-allocation) –