Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct TT
- {
- int ch;
- int z;
- };
- void foo(TT *);
- ////////////////////////////////////////////////////////// sizeof(TT)
- int main()
- {
- TT *p = new(TT);
- TT &aT = *p;
- aT.ch = 1;
- aT. z = 3;
- foo(&aT);
- delete(p);
- }
- ////////////////////////////////////////////////////////////
- void foo(TT *p1)
- {
- printf("aT.ch = %d\n", p1->ch);
- printf("aT. z = %d\n", p1-> z);
- }
- /*
- #include <stdio.h>
- #include <stdlib.h>
- struct TT
- {
- int ch;
- int z;
- };
- void foo(TT *);
- //////////////////////////////////////////////////////////
- int main()
- {
- TT *p = (TT*)malloc(sizeof(TT));
- TT &aT = *p;
- aT.ch = 1;
- aT. z = 3;
- foo(&aT);
- free(p);
- }
- ////////////////////////////////////////////////////////////
- void foo(TT *p1)
- {
- printf("aT.ch = %d\n", p1->ch);
- printf("aT. z = %d\n", p1-> z);
- }
- */
- /*
- #include <stdio.h>
- #include <stdlib.h>
- struct TT
- {
- int ch;
- int z;
- };
- //////////////////////////////////////////////////////////
- int main()
- {
- int *p = (int*)malloc(sizeof(int));
- int &a = *p;
- a = 12000;
- printf("a = %d\n", a);
- free(p);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement