Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void foo(int *);
- /////////////////////////////////////////////////////
- int main()
- {
- const int N = 20;
- int arr_mass[20];
- srand(22);
- for(int i = 0; i < N; i++)
- {
- arr_mass[i] = rand() % 999;
- printf("arr [%2d] = %3d\n", i, arr_mass[i]);
- }
- foo(&arr_mass[11]);
- return 0;
- }
- ///////////////////////////////////////////////////
- void foo(int *p)
- {
- printf("- - - - - - - - -\n");
- // printf("a = %3d\n", a);
- for(int i = -11; i < 9; i++)
- {
- printf("p[%4d] = %3d\n", i, p[i]);
- }
- return;
- }
- /*
- #include <stdio.h>
- #include <stdlib.h>
- void foo(int &);
- /////////////////////////////////////////////////////
- int main()
- {
- const int N = 20;
- int arr_mass[20];
- for(int i = 0; i < N; i++)
- {
- arr_mass[i] = rand() % 999;
- printf("arr [%2d] = %3d\n", i, arr_mass[i]);
- }
- foo(arr_mass[11]);
- return 0;
- }
- ///////////////////////////////////////////////////
- void foo(int &a)
- {
- int *p = &a;
- // p = p - 11;
- printf("- - - - - - - - -\n");
- printf("a = %3d\n", a);
- for(int i = -11; i < 9; i++)
- {
- printf("p[%2d] = %3d\n", i, p[i]);
- }
- return;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement