Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. typedef struct tomo
  2. {
  3. char titolo[100];
  4. char autore[100];
  5. int anno_pubblicazione;
  6. float prezzo;
  7. } t_libro;
  8.  
  9. main(){
  10. t_libro biblio[2];
  11. biblio[0] = {"Guida al C", "Fabrizio Ciacchi", 2003, 45.2};
  12. biblio[1] = {"Harry Potter e la Pietra Filosofale", "J.K.Rowling", 2003, 12.5};
  13. }
  14.  
  15. biblio[0].titolo = "Guida al C";
  16.  
  17. biblio[0] = {"Guida al C", "Fabrizio Ciacchi", 2003, 45.2};
  18.  
  19. t_libro biblio[] = {
  20. {"Guida al C", "Fabrizio Ciacchi", 2003, 45.2},
  21. {"Harry Potter e la Pietra Filosofale", "J.K.Rowling", 2003, 12.5}
  22. };
  23.  
  24. biblio[0].titolo = "Guida al C";
  25.  
  26. int main(void)
  27.  
  28. typedef char T_STRING[100] ;
  29.  
  30. typedef struct tomo
  31. {
  32. T_STRING titolo;
  33. T_STRING autore;
  34. int anno_pubblicazione;
  35. float prezzo;
  36. } t_libro;
  37.  
  38. t_libro biblio[] = {
  39. {"Guida al C", "Fabrizio Ciacchi", 2003, 45.2},
  40. {"Harry Potter e la Pietra Filosofale", "J.K.Rowling", 2003, 12.5}
  41. };
  42.  
  43. biblio[0].titolo[0] = 'G';
  44. biblio[0].titolo[1] = 'u';
  45. biblio[0].titolo[2] = 'i';
  46. biblio[0].titolo[3] = 'd';
  47. biblio[0].titolo[4] = 'a';
  48. biblio[0].titolo[5] = ' ';
  49. biblio[0].titolo[6] = 'a';
  50. biblio[0].titolo[7] = 'l';
  51. biblio[0].titolo[8] = ' ';
  52. biblio[0].titolo[9] = 'C';
  53. biblio[0].titolo[0] = ''; // (don't forget to initialize the end of your string)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement