Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- void foo(int* p);
- ///////////////////////////////////////////////
- int main()
- {
- int n, x;
- n = 100;
- x = 125;
- foo(&n);
- printf("n = %d\n", n);
- printf("x = %d\n", x);
- }
- ////////////////////////////////////////////////
- void foo(int *p)
- {
- int v;
- v = *p;
- *p = p[1];
- p[1] =v;
- }
- /*#include <stdio.h>
- int* foo();
- ///////////////////////////////////////////////////////// printf("%d ,", p[-1]);
- int main()
- {
- int* p = foo();
- for (int i = 0; i < 10; i++)
- {
- if (p[i] % 2 != 0)
- {
- printf("%d ,", p[i]);
- }
- }
- }
- ///////////////////////////////////////////////////////
- int* foo()
- {
- static int mas[10]{ 102,7773,125,132,135,144,151,154,159,162 };
- return &mas[0];
- }
- */
- /*
- #include <stdio.h>
- int foo();
- //////////////////////////////////////////////////////////////////
- int main() {
- //int c = 5;
- //int np = foo();
- for (int i = 0; i < 10; i++)
- {
- if (p[i] % 2 != 0)
- {
- printf("%d ,", p[i - c]);
- }
- }
- }
- ////////////////////////////////////////////////////////////////////
- int foo()
- {
- static int nx = -1;
- static int mas[10] = {102, 103, 125, 132, 135, 144, 151, 154, 159, 162 };
- nx++;
- if(nx == 10) nx = 0;
- //return &mas[v];
- return mas[nx];
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement