UP | HOME

HW38
COP-3223H

Submit via webcourses.

Using only your mind and/or pencil and paper (do not compile and run the program) Write a program that uses malloc to initialize a 12-element array of struct player structs called ptr:

  1. What does the type declaration look for pointer to a struct player.
  2. What does the malloc call and assignment to the look like
#include <stdio.h>

struct player {
  int x;
  int y;
};

int main() {
  // write your declaration of ptr here
  // write your assignment to ptr and call to malloc here
}

Author: Paul Gazzillo

Created: 2026-04-22 Wed 06:51

Validate