Advertisement
dllbridge

Untitled

Apr 26th, 2025
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.01 KB | None | 0 0
  1.  
  2.  
  3. #include <iostream>
  4. #include  <iomanip>
  5. #include <string.h>
  6. using namespace std;
  7.  
  8. void foo(char *sz);
  9.  
  10.  
  11.  
  12.  
  13. ////////////////////////////////////////////////////////////
  14. int main()
  15. {
  16.  
  17.     char sz[99] = "SONY Pictures";
  18.    
  19.    // cout << "Size of sz = " << sizeof(sz) << endl;
  20.  
  21.     foo(sz);
  22. }
  23.  
  24.  
  25.  
  26.  
  27. ////////////////////////////////////////////////////////////
  28. void foo(char *sz)
  29. {
  30.      
  31.      int nLen = strlen(sz);
  32.      
  33.     for(int i = 0; i < nLen; i++)
  34.     {
  35.         cout << "sz[" << setw(2) << i << "] = " << sz[i] << endl;
  36.     }    
  37.      
  38.      
  39. }
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. /*
  53. #include <iostream>
  54. using namespace std;
  55.  
  56. void foo(int *nArr);
  57.  
  58.  
  59.  
  60.  
  61. ////////////////////////////////////////////////////////////
  62. int main()
  63. {
  64.  
  65.     int nArr[5] = {7, 2, 2147483647, 21, 9};
  66.    
  67.     int n;
  68.    
  69.     cout << "Size of nArr[2] = " << sizeof(nArr  ) << endl;
  70.     cout << "Size of double  = " << sizeof(double) << endl;    
  71.     cout << "Size of char    = " << sizeof(char  ) << endl;    
  72.     foo(nArr);
  73. }
  74.  
  75.  
  76.  
  77.  
  78. ////////////////////////////////////////////////////////////
  79. void foo(int *n_Arr)
  80. {
  81.      
  82.      
  83.      
  84. }
  85.  
  86.  
  87. */
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108. /*
  109. #include <iostream>
  110. using namespace std;
  111.  
  112. void foo(int *nArr);
  113.  
  114.  
  115.  
  116.  
  117. ////////////////////////////////////////////////////////////
  118. int main()
  119. {
  120.  
  121.     int nArr[5] = {7, 2, 2147483647, 21, 9};
  122.    
  123.    
  124.     foo(nArr);
  125. }
  126.  
  127.  
  128.  
  129.  
  130. ////////////////////////////////////////////////////////////
  131. void foo(int *n_Arr)
  132. {
  133.      
  134.      int *p = &n_Arr[2];
  135.      
  136.      cout << "nArr[2] = " <<      p[-2]   << endl;
  137.      cout << "nArr[2] = " <<  n_Arr[ 0]   << endl;  p -= 2;
  138.      cout << "nArr[2] = " <<     *p       << endl;       
  139. }
  140.  
  141.  
  142. */
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151. /*
  152. #include <iostream>
  153. using namespace std;
  154.  
  155. void foo(int *nArr);
  156.  
  157.  
  158.  
  159.  
  160. ////////////////////////////////////////////////////////////
  161. int main()
  162. {
  163.  
  164.     int nArr[5] = {33, 2, 2147483647, 21, 9};
  165.    
  166.    
  167.     foo(nArr);
  168. }
  169.  
  170.  
  171.  
  172.  
  173. ////////////////////////////////////////////////////////////
  174. void foo(int *n_Arr)
  175. {
  176.      
  177.      int *p = &n_Arr[2];
  178.      
  179.      cout << "nArr[2] = " <<      p[-2]   << endl;
  180.      cout << "nArr[2] = " <<  n_Arr[ 0]   << endl;  p = &n_Arr[0];
  181.      cout << "nArr[2] = " <<     *p       << endl;       
  182. }
  183.  
  184.  
  185. */
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197. /*
  198.  
  199. #include <iostream>
  200. using namespace std;
  201.  
  202.  
  203.  
  204. ////////////////////////////////////////////////////////////
  205. int main()
  206. {
  207.  
  208.     int nArr[5] = {33, 2, 7, 21, 9};
  209.    
  210.     int *p = &nArr[2];
  211.    
  212.     cout << "nArr[2] = " <<     p[0]   << endl;
  213.     cout << "nArr[2] = " <<  nArr[2]   << endl;    
  214.     cout << "nArr[2] = " <<    *p      << endl;
  215.  
  216. }
  217. */
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229. /*
  230. #include <iostream>
  231. using namespace std;
  232.  
  233.  
  234. int  n = 2271;
  235. int *p = &n;
  236.  
  237.  
  238.  
  239.  
  240. ////////////////////////////////////////////////////////////
  241. int main()
  242. {
  243.  
  244.  
  245.    
  246.     cout << "n = " << *p    << endl;
  247.     cout << "n = " <<  n    << endl;    
  248.     cout << "n = " <<  p[0] << endl;   
  249.  
  250. }
  251.  
  252. */
  253.  
  254.  
  255.  
  256.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement