Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Cpp Lang: //
- #include <stdio.h>
- #include <string.h>
- struct TT
- {
- int n;
- char sz[99];
- };
- void foo(TT &dfgdfgdfg);
- ////////////////////////////////////////////////////
- int main() //
- {
- TT t1, t2, tarr[55];
- t1.n = 2016;
- strcpy(t1.sz, "Gleb");
- foo(t1);
- printf("D = %c\n", t1.sz[0]);
- printf("D = %d\n", t1.sz[0]);
- }
- /////////////////////////////////////////////////////
- void foo(TT &a) //
- {
- printf("t1.n = %d\n", a.n );
- printf("t1.sz = %s\n", a.sz);
- }
- // C Lang: //
- #include <stdio.h>
- #include <string.h>
- struct TT
- {
- int n;
- char sz[99];
- };
- void foo(struct TT *p);
- ////////////////////////////////////////////////////
- int main() //
- {
- struct TT t1, t2, tarr[55];
- t1.n = 2006;
- strcpy(t1.sz, "Tanya");
- foo(&t1);
- printf("D = %c\n", t1.sz[0]);
- printf("D = %d\n", t1.sz[0]);
- }
- /////////////////////////////////////////////////////
- void foo(struct TT *p) //
- {
- printf("t1.n = %d\n", (*p) .n );
- printf("t1.sz = %s\n", p->sz);
- }
- /*
- #include <stdio.h>
- struct TT
- {
- int n;
- char sz[99];
- };
- ////////////////////////////////////////////////////
- int main() //
- {
- struct TT t1, t2, tarr[55];
- t1.n = 2002;
- t1.sz[0] = 'D';
- t1.sz[1] = 'i';
- t1.sz[2] = 'm';
- t1.sz[3] = 'a';
- t1.sz[4] = 0 ; //'\0';
- printf("t1.n = %d\n", t1.n );
- printf("t1.sz = %s\n", t1.sz);
- printf("D = %c\n", t1.sz[0]);
- printf("D = %d\n", t1.sz[0]);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement