我的C代码遇到了一些问题:
输入:整数数组[16]
((whished)Output:array2 [4] [4]所以array2 [0] [1] -array2 [0] [3]]]]]
我现在得到了类似的东西,但是我不知道为什么它不起作用;我知道array [1] = *(array + 1);
如果某人能帮助我会很棒。
int write_from_state(int *state[][4]) { encryption[0] = state[0][0]; encryption[1] = state[1][0]; encryption[2] = state[2][0]; encryption[3] = state[3][0]; encryption[4] = state[0][1]; encryption[5] = state[1][1]; encryption[6] = state[2][1]; encryption[7] = state[3][1]; encryption[8] = state[0][2]; encryption[9] = state[1][2]; encryption[10] = state[2][2]; encryption[11] = state[3][2]; encryption[12] = state[0][3]; encryption[13] = state[1][3]; encryption[14] = state[2][3]; encryption[15] = state[3][3]; return encryption; }
我得到错误
警告:赋值使指针从整数开始而没有强制转换[-Wint-conversion]状态[0] [0] = msg [0];
我的C代码遇到了一些问题:输入:int array [16](whished)输出:array2 [4] [4]因此array2 [0] [1] -array2 [0] [3]中的前4个元素我现在有了类似的东西,但我不知道为什么...
int *write_from_state(int *dest, int *src, size_t rowLength, size_t nRows)
{
int *tmp = dest;
while(nRows--)
{
memcpy(tmp, src, sizeof(*src) * rowLength);
tmp += rowLength;
src += rowLength;
}
return dest;
}