fscanf在将整数存储到数组之前执行算术运算

时间:2018-02-03 00:56:24

标签: c arrays scanf

嘿我想弄清楚是否可能 函数fscanf对它在从文件中读取之前读取的整数进行操作。

例如:

for(int i = 0 ;i < size;i++){
    //Here it just stores the number read
    fscanf(file, "%d", &arr[i]);
    //However I'm trying to do such a thing(substract the number by 1 everytime)
    fscanf(file, "%d -1 ", &arr[i]);
    printf("\n%d",arr[i]);
}

提前致谢

1 个答案:

答案 0 :(得分:0)

这不能满足您的需求吗?

3 * 4