Menu

(Solved) : 10 I8 Points Problem 78 P345 Consider Following C Definition General Linked List Node Type Q28621235 . . .

10. I8 points] (From Problem 7.8, p.345) Consider the following C definition of a general linked list node: typedef struct GNode void data; struct GNode * next; GNode; Note the data field doesnt hold the data, it points to the actual data (or is NULL if theres no actual data). Use this definition to write a program that declares an array of four GNode values and sets them up to represent a linked list with four nodes with values (1) none (i.e., the NULL val field). (2) the integer 17, (3) the double 18.5, and (4) the character A. Print out the addresses in the four data fields and the data they point to (if there is any). Also print out the addresses in the four next fields. (Dont forget you can print an address using the %p format with printf.) Note youll need multiple print statements to print out the different data values. For example, your output (doesnt have to exactly match the output below but) might include lines like nodel0] at ox7fff59blc960, data at 0x0, next at 0x7fffs9blc960 nodel1] at 0x7fffs9blc970, data at ox7fff59blc95c has value 17, next at 0xfff59blc980

10. I8 points] (From Problem 7.8, p.345) Consider the following C definition of a general linked list node: typedef struct GNode void data; struct GNode * next; GNode; Note the data field doesn’t hold the data, it points to the actual data (or is NULL if there’s no actual data). Use this definition to write a program that declares an array of four GNode values and sets them up to represent a linked list with four nodes with values (1) none (i.e., the NULL val field). (2) the integer 17, (3) the double 18.5, and (4) the character ‘A’. Print out the addresses in the four data fields and the data they point to (if there is any). Also print out the addresses in the four next fields. (Don’t forget you can print an address using the %p format with printf.) Note you’ll need multiple print statements to print out the different data values. For example, your output (doesn’t have to exactly match the output below but) might include lines like nodel0] at ox7fff59blc960, data at 0x0, next at 0x7fffs9blc960 nodel1] at 0x7fffs9blc970, data at ox7fff59blc95c has value 17, next at 0xfff59blc980 Show transcribed image text

Expert Answer


Answer to 10 I8 Points Problem 78 P345 Consider Following C Definition General Linked List Node Type Q28621235 . . .

OR