Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- #include <stdlib.h>
- #include <stdio.h>
- int nArr[2][3] = {0, 1, 2, 3, 4, 5 };
- ///////////////////////////////////////////
- int main()
- {
- printf("%d\n", nArr[1][1]);
- printf("%d\n", nArr[0][0]);
- printf("%d\n", nArr[0][1]);
- printf("%d\n", nArr[0][2]);
- printf("- - - - - - - \n");
- printf("%d\n", &nArr[0][0]);
- printf("%d\n", &nArr[0][1]);
- printf("%d\n", &nArr[0][2]);
- printf("%d\n", &nArr[1][0]);
- printf("%d\n", &nArr[1][1]);
- printf("%d\n", &nArr[1][2]);
- }
- */
- /*
- #include <time.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <iostream>
- void foo(const int& n);
- //////////////////////////////////////////////////
- int main() //
- {
- srand(time(0));
- int a[20];
- for (int i = 0; i < 20; i++) // заполнения массива
- {
- a[i] = rand()%200;
- printf("%d\n", a[i]);
- } printf(" - - - - - - -\n");
- int &b = a[11];
- foo(b);
- }
- ////////////////////////////////////////////////////
- void foo(const int &n) //
- {
- printf("%d\n", &n);
- for (int i = -1; i < 11; i++)
- {
- printf("%d ", &n - 1 * (10-i) );
- }
- for (int i = 1; i < 9; i++)
- {
- printf("%d ", &n + 1 * i);
- }
- }
- */
- /*
- #include <time.h>
- #include <stdlib.h>
- #include <stdio.h>
- void foo(int& n);
- ///////////////////////////////////////////
- int main()
- {
- int a[20];
- srand(time(0));
- for(int i = 0; i < 20; i++) // заполнения массива
- {
- a[i] = rand()%200;
- printf("%3d\n", a[i] );
- } printf(" - - - - - - - =\n");
- foo( a[11] );
- }
- ///////////////////////////////////////////
- void foo(int &n) //
- {
- int *p = &n;
- n = (int)p;
- n -= 44;
- p = (int*)n;
- for(int i = 0; i < 20; i++)
- {
- printf("%d\n", p[i] );
- }
- }
- */
- /*
- #include <time.h>
- #include <stdlib.h>
- #include <stdio.h>
- void foo(int& n);
- ///////////////////////////////////////////
- int main()
- {
- int a[20];
- srand(time(0));
- for(int i = 0; i < 20; i++) // заполнения массива
- {
- a[i] = rand()%200;
- printf("%3d\n", a[i] );
- } printf(" - - - - - - - =\n");
- foo( a[11] );
- }
- ///////////////////////////////////////////
- void foo(int &n) //
- {
- int *p = &n;
- printf("%d\n", p); p = p - 11;
- printf("%d\n", p);
- for(int i = 0; i < 20; i++)
- {
- printf("%d\n", p[i] );
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement