Advertisement
dllbridge

Untitled

Jan 25th, 2025
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1.  
  2.  
  3. #include  <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. /////////////////////////////////////
  7. struct T
  8. {
  9.        
  10.     int  n;      
  11.     T   *pNext;
  12.        
  13. }t1, t2;
  14.  
  15.  
  16. T t3, t4;
  17.  
  18.  
  19.  
  20. ///////////////////////////////////////////////
  21. int main()
  22. {
  23.  
  24.     T t5, t6;
  25.    
  26.     t1.n = 12;
  27.      
  28.     t1.pNext = &t2;
  29.     t2.pNext = &t3;
  30.     t3.pNext = &t4;
  31.     t4.pNext = &t5;
  32.     t5.pNext = &t6;
  33.      
  34.      
  35.     T *p = &t1;
  36.    
  37.     for(int i = 0; i < 6; i++)
  38.     {
  39.        printf("%d, ", p->n);    
  40.        
  41.        p = p->pNext;    
  42.     }  
  43.                        
  44. }
  45.  
  46.  
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement