fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. struct node
  6. {
  7. char *name;
  8. int points;
  9. struct node *next;
  10. };
  11.  
  12.  
  13.  
  14. int main(void) {
  15.  
  16.  
  17. struct node node1[20],node2[20],node3[20],node4[20],node5[20],*head;
  18. char szContent[2048]={'\0'};
  19. int numread =0;
  20. int c,i;
  21.  
  22. FILE *pFile = fopen("c:/test.txt","r");
  23.  
  24.  
  25.  
  26.  
  27.  
  28. i=0;
  29.  
  30. do{
  31. node1[i].name=&szContent[i];
  32. i++;
  33.  
  34. } while ( szContent[i]!='\n');
  35. i++;
  36. do{
  37. node2[i].name=&szContent[i];
  38. i++;
  39. } while (szContent[i]!='\n' );
  40. i++;
  41. do{
  42. node3[i].name=&szContent[i];
  43. i++;
  44.  
  45. } while (szContent[i]!='\n');
  46.  
  47. i++;
  48. do{
  49. node4[i].name=&szContent[i];
  50. i++;
  51.  
  52. } while (szContent[i] !='\n' );
  53. i++;
  54. do{
  55. node5[i].name=&szContent[i];
  56. i++;
  57.  
  58. } while (szContent[i] !='\n' );
  59.  
  60.  
  61. node1[19].next = &node2[0];
  62. node2[19].next = &node3[0];
  63. node3[19].next = &node4[0];
  64. node4[19].next = &node5[0];
  65. node5[19].next = NULL;
  66. head=&node1[0];
  67.  
  68. for(i=0;i<20;i++)
  69. printf("%s",node1[i].name);
  70.  
  71.  
  72.  
  73.  
  74. system("pause");
  75. return 0;
  76.  
  77. }
  78.  
Runtime error #stdin #stdout 0.02s 2852KB
stdin
Standard input is empty
stdout
Standard output is empty