我想做这个:
char a[5];
//run some code here
//then
a[]={0,1,2,3,4}; //**compiler doesn't like it
Run Code Online (Sandbox Code Playgroud)
但我不想这样做:
a[0]=0;
a[1]=1;
a[2]=2;
a[3]=3;
a[4]=4;
Run Code Online (Sandbox Code Playgroud)
您是否知道在运行时使用数字而不是字符串(即不是a ="hello")一次填充数组,而不是单独定义每个元素?
谢谢,
拉伊德
c ×1