Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- ////////////////////////////////////////////////////
- int main()
- {
- int *p = (int *)malloc(4);
- printf("address p = %d \n", &p);
- printf(" p = %d \n", p);
- *p = 4;
- printf(" *p = %d \n", *p);
- int &a = *p;
- printf(" a = %d \n", a);
- }
- /*
- #include <stdio.h>
- struct TT
- {
- int x;
- float f;
- };
- void foo(struct TT *);
- ////////////////////////////////////////////////////
- int main()
- {
- struct TT t;
- t.x = 71;
- t.f = 60.2;
- printf("old %d\n", t.x);
- printf("weight %.2f\n", t.f);
- foo(&t);
- struct TT *p = &t; // ñîçäàþ óêàçàòåëü íå ïåðåìåííóþ t
- int y = (*p).x; // Ïîëó÷àåì çíà÷åíèå ýëåìåíòà X?
- (*p).x = 72;
- printf("newold %d\n", (*p).x);
- printf("newold %d\n", y);
- }
- ////////////////////////////////////////////////////
- void foo(struct TT *p)
- {
- printf("old %d\n", (*p).x);
- printf("weight %.2f\n", p->f);
- }
- */
- /*
- int n = 3;
- printf("value %d\n", n);
- printf("adres %d\n", &n);
- printf("adres %x\n", &n);
- printf("size of = %d", sizeof (float));
- */
- /*
- #include <stdio.h>
- /////////////////////////////////////////////////////////
- struct Dima
- {
- int nMin;
- int nHours;
- int nDays;
- }t1, t2;
- struct Dima t3, t4;
- //////////////////////////////////////////////////////////
- int main()
- {
- struct Dima t5, t6;
- t5.nMin = 58;
- struct Dima *p = &t5;
- p->nMin = 59;
- printf("t5.nMin = %d\n", t5.nMin);
- }
- */
- /*
- #include <stdio.h>
- void foo(int *);
- //////////////////////////////////////////////////////////
- int main()
- {
- int nArr[10] = {44, 1, 2, 3, 4, 55, 6, 7, 8, 9};
- foo(nArr);
- }
- //////////////////////////////////////////////////////////
- void foo(int *p)
- {
- for(int i = 0; i < 10; i++)
- {
- printf("nArr[%d] = %2d \n", i, p[i]);
- }
- }
- */
- /*
- #include <stdio.h>
- char sz[99] = "nArr = %d \n";
- //////////////////////////////////////////////////////////
- int main()
- {
- printf("sz[1] = %c \n", sz[1]);
- }
- */
- /*
- #include <stdio.h>
- int nArr[10] = {44, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- char sz[99] = "nArr = %d \n";
- //////////////////////////////////////////////////////////
- int main()
- {
- printf(sz, nArr );
- printf("nArr = %d \n", &nArr[0]);
- printf("nArr = %d \n", &nArr[1]);
- printf("printf = %d \n", printf );
- printf("size of sz = %d \n", sizeof(sz) );
- }
- */
- /*
- #include <stdio.h>
- int nArr[10] = {44, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- //////////////////////////////////////////////////////////
- int main()
- {
- int *p = &nArr[4];
- printf("&nArr[4] = %d \n", p );
- printf("&nArr[4] = %d \n", &nArr[4]);
- printf("&nArr[5] = %d \n", &nArr[5]);
- printf("&nArr[5] = %d \n", p + 1 );
- printf("&nArr[5] = %d \n", &p[1] );
- printf("&nArr[5] = %d \n", p[1] );
- }
- */
- /*
- #include <stdio.h>
- int n = 44;
- //////////////////////////////////////////////////////////
- int main()
- {
- printf("address of n = %d \n", &n);
- int *p = &n;
- printf("address of n = %d \n", p);
- printf("address of p = %d \n", &p);
- }
- */
- /*
- #include <stdio.h>
- //////////////////////////////////////////////////////////
- void foo(char *c) //
- {
- // printf("adress nArr = %s\n", c);
- char cBuf = c[0];
- c[0] = c[3];
- c[3] = cBuf;
- cBuf = c[1];
- c[1] = c[2];
- c[2] = cBuf;
- }
- //////////////////////////////////////////////////////////
- int main()
- {
- char nArr[6] = "SONY";
- foo(nArr);
- printf("nArr = %s\n", nArr);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement