Advertisement
dllbridge

Untitled

Feb 26th, 2025
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.86 KB | None | 0 0
  1.  
  2.  
  3. #include    <stdio.h>
  4. #include   <string.h>
  5. #include   <locale.h>       //  здесь "живёт" setlocale(LC_ALL, "rus");
  6.  
  7. //////////////////////////////
  8. struct T
  9. {
  10.     int n;
  11.     T  *pNext;      
  12.        
  13. };
  14.  
  15.  
  16. T t1, t2;
  17.  
  18. void monitoe(T *p);
  19.  
  20. /////////////////////////////////////////////////////////
  21. int main()
  22. {
  23.    
  24.     T t3, t4;
  25.    
  26.     t1.n = 5;
  27.    
  28. /*  printf("t1.n = %d\n", t1.n);
  29.     printf("t2.n = %d\n", t2.n);
  30.     printf("t3.n = %d\n", t3.n);       
  31.     printf("t4.n = %d\n", t4.n);
  32.   */  
  33.     t1.pNext = &t2;
  34.     t2.pNext = &t3;
  35.     t3.pNext = &t4;
  36.    
  37.     t4.pNext = 0;
  38.    
  39.     monitoe(&t1);  
  40. }
  41.  
  42.  
  43. /////////////////////////////////////////////////////////
  44. void monitoe(T *p)
  45. {
  46.    
  47.      while(p->pNext != 0)
  48.      {
  49.                    
  50.          printf("t_.n = %d\n", p->n);
  51.          p = p->pNext;        
  52.      }
  53.      
  54. }
  55.  
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement