【发布时间】:2021-08-06 17:04:20
【问题描述】:
附上最小示例:
struct MyStruct {
int a;
};
void testFun(struct MyStruct* testStruct) {
printf("a: %s", testStruct->a);
};
void main(){
struct MyStruct testStruct = { .a = 1 };
testFun(&testStruct);
};
这让我很震惊:test.exe 中的 0x791428BC (ucrtbased.dll) 抛出异常:0xC0000005:访问冲突读取位置 0x00000001。
我在这里缺少什么?
【问题讨论】:
-
你用的是什么编译器?不是告诉你格式字符串和参数不匹配吗?
标签: c struct memory-management