Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <string.h>
- using namespace std;
- void foo(char *sz);
- ////////////////////////////////////////////////////////////
- int main()
- {
- char sz[99] = "SONY Pictures";
- // cout << "Size of sz = " << sizeof(sz) << endl;
- foo(sz);
- }
- ////////////////////////////////////////////////////////////
- void foo(char *sz)
- {
- int nLen = strlen(sz);
- for(int i = 0; i < nLen; i++)
- {
- cout << "sz[" << setw(2) << i << "] = " << sz[i] << endl;
- }
- }
- /*
- #include <iostream>
- using namespace std;
- void foo(int *nArr);
- ////////////////////////////////////////////////////////////
- int main()
- {
- int nArr[5] = {7, 2, 2147483647, 21, 9};
- int n;
- cout << "Size of nArr[2] = " << sizeof(nArr ) << endl;
- cout << "Size of double = " << sizeof(double) << endl;
- cout << "Size of char = " << sizeof(char ) << endl;
- foo(nArr);
- }
- ////////////////////////////////////////////////////////////
- void foo(int *n_Arr)
- {
- }
- */
- /*
- #include <iostream>
- using namespace std;
- void foo(int *nArr);
- ////////////////////////////////////////////////////////////
- int main()
- {
- int nArr[5] = {7, 2, 2147483647, 21, 9};
- foo(nArr);
- }
- ////////////////////////////////////////////////////////////
- void foo(int *n_Arr)
- {
- int *p = &n_Arr[2];
- cout << "nArr[2] = " << p[-2] << endl;
- cout << "nArr[2] = " << n_Arr[ 0] << endl; p -= 2;
- cout << "nArr[2] = " << *p << endl;
- }
- */
- /*
- #include <iostream>
- using namespace std;
- void foo(int *nArr);
- ////////////////////////////////////////////////////////////
- int main()
- {
- int nArr[5] = {33, 2, 2147483647, 21, 9};
- foo(nArr);
- }
- ////////////////////////////////////////////////////////////
- void foo(int *n_Arr)
- {
- int *p = &n_Arr[2];
- cout << "nArr[2] = " << p[-2] << endl;
- cout << "nArr[2] = " << n_Arr[ 0] << endl; p = &n_Arr[0];
- cout << "nArr[2] = " << *p << endl;
- }
- */
- /*
- #include <iostream>
- using namespace std;
- ////////////////////////////////////////////////////////////
- int main()
- {
- int nArr[5] = {33, 2, 7, 21, 9};
- int *p = &nArr[2];
- cout << "nArr[2] = " << p[0] << endl;
- cout << "nArr[2] = " << nArr[2] << endl;
- cout << "nArr[2] = " << *p << endl;
- }
- */
- /*
- #include <iostream>
- using namespace std;
- int n = 2271;
- int *p = &n;
- ////////////////////////////////////////////////////////////
- int main()
- {
- cout << "n = " << *p << endl;
- cout << "n = " << n << endl;
- cout << "n = " << p[0] << endl;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement