|
回复 9# salent
感谢先!
看了帮助文档,例子如下:
Action() {
char sentence[] = "After 7 years' siege yet Troy walls stand";
char s1[32], s2[32];
int num_of_years;
sscanf(sentence,"%s %d %s", s1, &num_of_years, s2);
lr_output_message("Number of years=%d s2=\"%s\"", num_of_years, s2);
return 0;
}
Output:
Action.c(7): Number of years=7 s2="years'"
有个地方不明白 : sscanf(sentence,"%s %d %s", s1, &num_of_years, s2);
我去掉&num_of_years前面的 & 之后就报错:
Action.c(7): Error: C interpreter run time error: Action.c (7): Error -- memory violation : Exception ACCESS_VIOLATION received.
请问这是什么问题? |
|