Question: (Memory allocation) Consider typedef struct {char name [20]; int balance; int gain;} Player; int n; Player *p; scanf (d, &n); ...... Complete the code above
![(Memory allocation) Consider typedef struct {char name [20]; int balance; int](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3e5550bae5_98866f3e5546c2d0.jpg)
(Memory allocation) Consider typedef struct {char name [20]; int balance; int gain;} Player; int n; Player *p; scanf ("d", &n); ...... Complete the code above by allocating a memory for n players each of which of type Player and making p point to the start of that memory (or in other words, making p have the value of the starting address of that memory). [Recall the slides on dynamic memory allocation function malloc.]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
