Advertisement
dllbridge

Untitled

Feb 26th, 2025
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1.  
  2.  
  3. #include <stdio.h>
  4.  
  5. class T
  6. {
  7.     public:
  8.     int  n;
  9.     T* pNext;
  10.  
  11. };
  12.  
  13.  
  14.  
  15.  
  16. T  t_1,
  17.    t_2,
  18.    t_3,
  19.    t_4,
  20.    t_5,
  21.    t_6;
  22.  
  23.  
  24. void  rust(T*p);
  25.  
  26. ////////////////////////////////////////////////
  27. int main()
  28. {
  29.     t_1.n =   5;
  30.     t_2.n =  15;
  31.     t_3.n =  25;
  32.     t_4.n =  35;
  33.     t_5.n =  45;
  34.     t_6.n = 100;
  35.     t_1.pNext = &t_2;
  36.     t_2.pNext = &t_3;
  37.     t_3.pNext = &t_4;
  38.     t_4.pNext = &t_5;
  39.     t_5.pNext = &t_6;  
  40.    
  41.     rust(&t_1);
  42. }
  43. //////////////////////////////////////////////////////
  44. void  rust(T *p)
  45. {
  46.      
  47.       int i= 0;
  48.  
  49. L_01: printf("%3d\n",p->n);
  50.  
  51.       p = p->pNext;
  52.      
  53.       i++;
  54.      
  55.       if (i < 6)  goto L_01;
  56. }
  57.  
  58.  
  59.  
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement