fork download
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. struct kunde
  6. {
  7. int kdn_Nr;
  8. char vorName[21];
  9. char nachName[21];
  10. };
  11. struct buch
  12. {
  13. int buch_Nr;
  14. char buch_Titel[21];
  15. char buch_Autor[21];
  16. struct kunde *ausleih_cmt;
  17. };
  18.  
  19.  
  20. main()
  21. {
  22. int x;
  23. int int_auswahl=1;
  24. int check_kunde;
  25. struct kunde struct_kunde[500]={NULL};
  26. struct kunde *ptr_kunde[500]={NULL};
  27. struct buch struct_buch[1000]={NULL};
  28. struct buch *ptr_buch[1001]={NULL};
  29.  
  30. for(x=0;x<=999;x++)
  31. {
  32. if(x<=499)
  33. ptr_kunde[x]=&struct_kunde[x];
  34.  
  35. ptr_buch[x]=&struct_buch[x];
  36. }
  37.  
  38. ptr_buch[0]->ausleih_cmt=ptr_kunde[0];
  39. Ausleihliste(ptr_buch);
  40. return EXIT_SUCCESS;
  41. }
  42.  
  43.  
  44. void Ausleihliste(struct buch *ptr_buch[])
  45. {
  46. int x;
  47. printf("---------------------------\n");
  48. for(x=0;x<=999;x++)
  49. {
  50. printf( "ptr_buch[ %d ]->buch_Nr = %d\n", x, ptr_buch[x]->buch_Nr );
  51. if(ptr_buch[x]->buch_Nr=='\0') {
  52.  
  53. puts( "break;" );
  54. break;
  55. }
  56. else if(puts( "else if reached." ), ptr_buch[x]->ausleih_cmt->kdn_Nr!='\0')
  57. {
  58. printf("%-10d%-10s%-10s%-10d%-10s%-10s\n",
  59. ptr_buch[x]->buch_Nr,
  60. ptr_buch[x]->buch_Autor,
  61. ptr_buch[x]->buch_Titel,
  62. ptr_buch[x]->ausleih_cmt->kdn_Nr,
  63. ptr_buch[x]->ausleih_cmt->nachName,
  64. ptr_buch[x]->ausleih_cmt->vorName);
  65. }
  66. }
  67. printf("---------------------------\n\n");
  68. }
Success #stdin #stdout 0.01s 1680KB
stdin
Standard input is empty
stdout
---------------------------
ptr_buch[ 0 ]->buch_Nr = 0
break;
---------------------------