-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2D_array_operations.cpp
More file actions
62 lines (60 loc) · 1017 Bytes
/
2D_array_operations.cpp
File metadata and controls
62 lines (60 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <stdio.h>
void Afiche(int * );
void Remplir(int*,int*);
int x=3,y=3,i,j;
int main(){
int tab[x][y];
Remplir(&tab[0][0],&tab[0][1]);
Afiche(&tab[0][0]);
printf("the real table\n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("%d ",tab[i][j]);
}
printf("\n");
}
printf("ints coords table\n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("%d ",&tab[i][i]);
}
printf("\n");
}
}
void Remplir(int*tab,int*tab2)
{
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("donnez l\'element de line %d collon %d whish has the adress %d : ",i+1,j+1,(tab+y*i+j));
scanf("%d",&*(tab+y*i+j));
}
}
}
void Afiche(int* tab)
{
printf("the expected tables\n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("%d ",*(tab+i*y+j));
}
printf("\n");
}
printf("its coords:\n");
printf("the expected tables\n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("%d ",(tab+i*y+j));
}
printf("\n");
}
}