我在尝试从文本文件中读取整数时遇到了麻烦:
#include <stdio.h>
#include <string.h>
int main()
{
int op;
/* Open file for both reading and writing */
FILE *d = fopen("intento1.txt", "r");
FILE *f = fopen("bubbletry.txt", "w+");
/* Read and display data */
fread(&op, 4, 1, d);
printf("%d\n", &op);
fclose(d);
/* Write data to the file */
fprintf(f,"%d\n",&op);
fclose(f);
return(0);
}
Run Code Online (Sandbox Code Playgroud)
"intento1.txt"中的第一个数字是30771,但写在"bubbletry.txt"的文本是926363699.你能告诉我为什么会这样吗?