Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int nArr[99] = {7, 11, 2333, 3, 4, 5, 6 };
- void foo(int *point);
- /////////////////////////////////////////////////////////
- int main()
- {
- int n = 411;
- int *p = (int*)malloc(sizeof(int)*99);
- for(int i = 0; i < 10; i+=1)
- {
- p[i] = i;
- }
- foo(p+5);
- }
- ///////////////////////////////////////////////////////////
- void foo(int *point)
- {
- for(int i = -5; i < 5; i+=1)
- {
- printf("%d\n", point[i]);
- }
- }
- /*
- #include <stdio.h>
- #include <stdlib.h>
- int nArr[99] = {7, 11, 2333, 3, 4, 5, 6 };
- /////////////////////////////////////////////////////////
- int main()
- {
- int n = 411;
- int *p = (int*)malloc(4);
- *p = 111;
- int &r = *p;
- printf("*p = %d\n", *p);
- printf(" p = %d\n", p);
- printf(" r = %d\n", r);
- free(p);
- }
- */
- /*
- #include <stdio.h>
- #include <stdlib.h>
- int nArr[99] = {7, 11, 2333, 3, 4, 5, 6 };
- /////////////////////////////////////////////////////////
- int main()
- {
- int n = 411;
- int *p = (int*)malloc(4);
- // *p = 13;
- printf("*p = %d\n", *p);
- printf(" p = %d\n", p);
- free(p);
- }
- */
- /*
- // SUPER
- #include <stdio.h>
- int n = 411;
- int nArr[99] = {7, 11, 2333, 3, 4, 5, 6 };
- /////////////////////////////////////////////////////////
- int main()
- {
- printf("nArr = %d\n", nArr);
- int *p = nArr;
- printf(" p = %d\n", p);
- printf("*p = %7d\n", *p);
- printf("nArr[1] = %7d\n", *(p+1) );
- printf("nArr[2] = %7d\n", *(&(*(p+2))) );
- printf("nArr[3] = %7d\n", p[3] );
- }
- */
- /*
- #include <stdio.h>
- int n = 411;
- int *p = &n;
- /////////////////////////////////////////////////////////
- int main()
- {
- printf(" n = %8d\n", n);
- printf("address of n = % d\n", &n);
- printf(" n = %8d\n", *p);
- printf("address of n = % d\n", p);
- return 0;
- }
- */
- // Альтернативный вариант простейшей программы. Exe-файл будет "весить" меньше в несколько десятков раз !!!
- /*
- #include <stdio.h>
- int n = 44;
- /////////////////////////////////////////////////////////
- int main()
- {
- printf(" n = %8d\n", n);
- printf("address of n = % d\n", &n);
- return 0;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement