Olb*_*a12 -1 c printing string
我学习C和尝试,我写了一个小程序.
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
int *x = malloc(sizeof(int)*3);
int i;
for(i=0;i<3; i++){
x[i] = i*i;
printf("x[i] = %d\n", x[i]);
}
free(x);
}
Run Code Online (Sandbox Code Playgroud)
现在输出是(ofc it)
x [i] = 0
x [i] = 1
x [i] = 4
我的问题是,我如何更改代码以获得输出?
x [0] = 0
x [1] = 1
x [2] = 4
| 归档时间: |
|
| 查看次数: |
57 次 |
| 最近记录: |