Прежде всего, я хочу показать вам, что на самом деле я хочу ........
, если ввод ...
2 3 4
5 6 6
7 5 4
вывод должен быть ...
7 5 4
2 3 4
5 6 6 /*Each row is shifted circularly left by two positons */
Я пробовал этот код в соотв.насколько мне известно (я новичок в C) и написал эту вещь ..
/*To shift row of a 4 * 5 matrix by 2 positons left*/
#include<stdio.h>
int main() {
int a[4][5],i,j,k,(*temp)[5];
for(i=0;i<=3;i++) {
for(j=0;j<=4;j++)
scanf("%d",*(a+i)+j);
}
for (k=1;k<=2;k++) {
for(i=0;i<=3;i++) {
temp = (a+i); /*I thought that *(a+i) will point to the address of each row and so I should take it in a variable which is capable of pointing to a row of 5 variables that why TEMP */
(a+i) = (a+i+1);
(a+i+1) = temp;
}
}
for(i=0;i<=3;i++) {
for(j=0;j<=4;j++)
printf("%d\t",*(*(a+i)+j));
printf("\n");
}
return 0;
}
где я не прав ..... Пожалуйста, поправьте меня ????