Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the lines of code below. Indicate which are invalid,meaning either they

ID: 3615515 • Letter: C

Question

Consider the lines of code below. Indicate which are invalid,meaning either they would not compile or they may produce a memoryfault.

(1) #define TOTAL5                                                        
(2) #define TURTLE 2;
(3) typedef struct automobile {
(4)                                         char name[TOTAL];
(5)                                         int    vehicle_id;
(6)                                         float kpg;
(7)                                         double *manuf_code;
(8)                                      } Entry;
(9)   Entry list[3], *passenger;
(11) char who[7], a, *b;
(12) double *d, d2;
(13)
(14) Entry.kpg = 35.6;
(15) list[1].kpg = 39.1;
(16) passenger ->kpg = 42.2;
(17) who[TOTAL] = TURTLE
(18) list[2].manuf_code = &d2;
(19) list.kpg = 28.7;
(20) Entry->manuf_code = 11;
(21) list[3].name[0] = who[1];
(22) list[TURTLE].vehicle_id = 7;
(23) list[TOTAL].vehicle_id = 3;
(24) passenger = &(list[0]);
(25) passenger->vehicle_id =3;

eg. (1) invalid - missing semicolon, (2)valid, (3)......(25)
    
  

Explanation / Answer

Dear...

1) Invalid -missing semicolon

2)Valid