Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <iostream>
- using namespace std;
- int _strlen(char *p);
- /////////////////////////////////////////////////////////
- int main()
- {
- char sz[99] = "SONY Pictures";
- int n = 58;
- int b = n;
- b = _strlen(sz);
- printf("address sz = %d\n", sz);
- // printf(" sz = %c\n",*sz);
- // printf(" sz = %d\n", &(*sz));
- // printf(" sz = %s\n", sz);
- // cout <<"b = "<< b << endl;
- }
- ///////////////////////////////////////////////////////////////
- int _strlen(char *p)
- {
- printf(" p = %d\n", p);
- printf(" *p = %c\n", *p);
- printf(" p[9] = %c\n", p[9]);
- return 0;
- }
- /*
- #include <stdio.h>
- #include <string.h>
- #include <iostream>
- using namespace std;
- int n = 15;
- /////////////////////////////////////////////////////////
- int main()
- {
- int *p = &n;
- n = n * 2;
- printf("address of n = %d \n", &n);
- printf(" n = %d \n", *(&(*(&n))) ); // 30, adr, 30, adr, 30
- printf("address of n = %d \n", &(*p));
- printf(" n = %d \n", *p);
- }
- */
- /*
- #include <stdio.h>
- #include <string.h>
- #include <iostream>
- using namespace std;
- int n = 15;
- /////////////////////////////////////////////////////////
- int main()
- {
- int *p = &n;
- n = n * 2;
- printf("address of n = %d \n", &n);
- printf(" n = %d \n", n);
- printf("address of n = %d \n", p);
- printf(" n = %d \n", *p);
- }
- */
- /*
- #include <stdio.h>
- #include <string.h>
- #include <iostream>
- using namespace std;
- int n = 15;
- /////////////////////////////////////////////////////////
- int main()
- {
- n = n * 2;
- printf("address of n = %d \n", &n);
- printf(" n = %d \n", n);
- }
- */
- /*
- #include <stdio.h>
- #include <string.h>
- #include <iostream>
- using namespace std;
- int _strlen(char *p);
- /////////////////////////////////////////////////////////
- int main()
- {
- char sz[99] = "SONY Pictures";
- int n = 58;
- int b = n;
- b = _strlen(sz);
- printf("address sz = %d\n", sz);
- printf(" sz = %c\n",*sz);
- printf(" sz = %s\n", sz);
- cout <<"b = "<< b << endl;
- }
- ///////////////////////////////////////////////////////////////
- int _strlen(char *p)
- {
- return 0;
- }
- */
- /*
- #include <stdio.h>
- #include <string.h>
- #include <iostream>
- using namespace std;
- int _strlen(char *p);
- /////////////////////////////////////////////////////////
- int main()
- {
- char sz[99] = "SONY Pictures";
- int n1 = _strlen(sz);
- int n = strlen(sz);
- cout << "strlen returned = " << n1 << endl;
- }
- //////////////////////////////////////////////////////////
- int _strlen(char *p)
- {
- int n = 10;
- printf("p = %c\n", *p);
- printf("p = %d\n", *p);
- cout << p << endl;
- return n;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement