i have array unknown size i want to transfer to matrix[n][2].Example;
D[c]=1,2,3,4,5
D[c/2][2]= 1 2
3 4
5 0
so if size of array odd i want add 0 last member of matrix.Here s my code but i dont know how to make 0 last member of matrix
if (c%2==1){c=c+1;}
for(r=0; r<(c/2); r++)
{
for(t=0; t<2; t++)
{
v++;
matris[r][t]=D[v-1];
}
}
matris[r][t]
printf("\nmatrice:\n\n");
for(r=0; r<(c/2); r++)
{
for(t=0; t<2; t++)
{
printf("%3u ", matris[r][t]);
}
printf("\n");
}
A possible solution would be to initialise the array to be all zeros:
Any not set during population would remain zero.