Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- char* foo(char*);
- //////////////////////////////////////////////////////////////
- int main()
- {
- char sz1[99] = "foo_foo";
- char *p2 = foo(sz1);
- strcpy(sz1, p2);
- printf("sz1 = %s\n", sz1);
- }
- //////////////////////////////////////////////////////////////
- char* foo(char *p) //
- {
- static char sz2[23] = " Next";
- static char sz3[99];
- strcpy(sz3, sz2);
- strcpy(sz2, p);
- printf("sz2 = %s\n", sz2);
- return sz3;
- }
- // printf("sz2 = %s\n", p2);
- /*
- #include <stdio.h>
- char* foo();
- //////////////////////////////////////////////////////////////
- int main()
- {
- char c, *p = foo();
- printf("%s\n", p);
- }
- //////////////////////////////////////////////////////////////
- char* foo() //
- {
- static char nArr[23] = " Next";
- return &nArr[1];
- }
- */
- // char a[8] = "SONY";
- /*
- #include <stdio.h>
- #include <string.h>
- char* foo(char* p);
- int main()
- {
- char a[8] = "SONY";
- char* p = foo(&a[2]);
- printf("%c\n", *p);
- }
- char* foo(char* p)
- {
- char nArr[23] = " Next";
- return &nArr[1];
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement