Advertisement
dllbridge

Untitled

Dec 15th, 2024
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  1.  
  2. #include  <stdio.h>
  3. #include <locale.h>
  4.  
  5. int foo(int *arr);
  6.  
  7. //////////////////////////////////////////////////////////////
  8. int main()
  9. {
  10.    
  11.     setlocale(LC_ALL, "rus");
  12.    
  13.     printf("LC_ALL = %d\n", LC_ALL);
  14.    
  15.     int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  16.     int result = foo(&arr[9]);
  17.  
  18.     printf("\nСодержимое элемента с индексом 1: %d\n", result);
  19.  
  20.     return 0;
  21. }
  22.  
  23.  
  24. /////////////////////////////////////////////////////////////
  25. int foo(int *arr)
  26. {
  27.     printf(" arr = %d\n",  arr);
  28.     printf("*arr = %d\n", *arr);
  29.     arr--;  
  30.     printf("Addres of arr = %d\n",  arr);
  31.     printf("*arr = %d\n", arr[-1]);    
  32.     return arr[1];
  33. }
  34.  
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement