Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- //////////////////////////////////////
- void foo(char* p)
- {
- // for (int i = 0; i < 5; i++)
- // {
- cout << p;
- //}
- }
- /////////////////////////////////////////////
- int main()
- {
- char nArr[10] = "SONY";
- foo(nArr);
- }
- /*
- #include <stdio.h>
- char* foo1();
- char* foo2();
- ////////////////////////////////////////////////////
- int main()
- {
- char *p = foo1();
- char *p2 = foo2();
- printf("%c \n", p[-2]);
- printf("%s %s \n", &p[-3], p2);
- printf("%s %s \n", foo1(), foo2() );
- }
- ///////////////////////////////////////////////////
- char* foo1()
- {
- static char nArr[15] = "SONY";
- return &nArr[3];
- }
- ////////////////////////////////////////////////////
- char* foo2()
- {
- static char nArr[15]= "Pictures";
- return nArr;
- }
- */
- /*
- #include <stdio.h>
- void foo(char*p);
- void foo1(char*p);
- //////////////////////////////////////////////
- int main()
- {
- char nArr [ 5] = "SONY";
- char nArr1[10] = " Pictures";
- foo ( nArr);
- foo1(nArr1);
- }
- //////////////////////////////////////////////
- void foo(char* p)
- {
- // for(int i=0;i<5;i++)
- // {
- printf("%s",p);
- // }
- }
- void foo1(char*p)
- {
- // for(int i=0;i<9;i++)
- // {
- printf("%s",p);
- // }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement