Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int arr0[4],
- *pArr[3],
- arr1[4],
- arr2[4];
- ////////////////////////////////////////////////////
- void init(int *p[4]) //
- {
- printf("Address arr0 = %d = %d = %d\n", arr0, p[0], pArr[0]);
- printf("Address arr1 = %d = %d = %d\n", arr1, p[1], pArr[1]);
- printf("Address arr2 = %d = %d = %d\n", arr2, p[2], pArr[2]);
- for(int i1 = 0; i1 < 3; i1++)
- for(int i2 = 0; i2 < 4; i2++)
- {
- p[i1][i2] = i1*4 + i2;
- }
- }
- ////////////////////////////////////////////////////
- int main() //
- {
- pArr[0] = arr0;
- pArr[1] = arr1;
- pArr[2] = arr2;
- init(pArr);
- for(int i1 = 0; i1 < 3; i1++) {
- for(int i2 = 0; i2 < 4; i2++)
- {
- printf("%2d ", pArr[i1][i2]);
- } printf("\n"); }
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- #include <stdio.h>
- int arr0[4],
- *pArr[3],
- arr1[4],
- arr2[4];
- ////////////////////////////////////////////////////
- void init(int *p[4]) //
- {
- printf("Address arr0 = %d = %d = %d \n", arr0, p[0], pArr[0]);
- printf("Address arr1 = %d = %d = %d \n", arr1, p[1], pArr[1]);
- printf("Address arr2 = %d = %d = %d\n\n", arr2, p[2], pArr[2]);
- for(int i1 = 0; i1 < 3; i1++) {
- for(int i2 = 0; i2 < 4; i2++)
- {
- printf(" pArr[%d][%d] = %d \n", i1, i2, &p[i1][i2]);
- } printf("\n"); }
- }
- ////////////////////////////////////////////////////
- int main() //
- {
- pArr[0] = arr0;
- pArr[1] = arr1;
- pArr[2] = arr2;
- init(pArr);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement