所以,我要做的就是創建一個數組將包含數N的多個表,IE:Ç - 數組,它包含有一個malloc()函數的多個表
"Enter a number = 6"
"1 2 3 4 5 6"
"2 4 6 8 10 12" and so on untill 36
這是我的代碼:
int * initiallizeArray(int * rows)
{
int i = 0, j = 0;
int * twoDArray = 0;
printf("Enter a number: ");
scanf("%d", rows);
twoDArray = (int*)malloc(sizeof(int) * (*rows * *rows));
for (i = 0; i < *rows; i++)
{
for (j = 0; j < *rows; j++)
{
//twoDArray[i * *rows + j] =
}
}
return twoDArray;
}
與「//」的線是什麼,我不知道該怎樣實現它裏面 基本上它循環所有的陣列上,但我不知道該怎麼投入的具體cell
NeXoR。好奇:誰或什麼文本建議在'twoDArray =(int *)malloc(...'? – chux