Thread: Structs, Pointers, Memory Allocation, Stacks

  1. #1
    Registered User
    Join Date
    Oct 2016
    Posts
    9

    Structs, Pointers, Memory Allocation, Stacks

    Hello Everyone!

    Okay so I am studying a computing course and i am new to the C language. I have been given an assignment but i have no idea where to start, if anyone could provide any useful information/links or resources it would be greatly appreciated!

    Below is a copy of what the assignment is asking for;


    Files you will create & submit: frame.h, frame_manager.h, frame_manager.c, Makefile

    frame.h - will contain the definition of a ‘Frame’ struct that contains two elements:
    an int value called ‘data’ and a Frame pointer called ‘next’. Make sure to use a typedef
    when defining your struct.

    frame_manager.h - will contain two function prototypes used for creating and
    destroying Frames (memory management). The signatures for these two functions are:
    Frame* getFrame()
    void releaseFrame(Frame* oldFrame)

    frame_manager.c - will contain the definition for these two function prototypes
    such that getFrame will allocate a new Frame in memory using calloc or malloc, and
    return a pointer to the new allocation; and releaseFrame will reset ‘oldFrame’s values to
    0 and NULL and free oldFrame’s memory.

    Please submit a Makefile for your entire project as well. Make sure to use
    CFLAGS = -Wall -Wextra –pedantic so that your compiler is extra picky.

    Any solutions would be a life saver!


    Thank you

  2. #2
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,111
    Your instructor should have given you all the information to be able to write the program on your own. You need to attempt to write the first cut of a program before asking questions here.

    Please study the Site Policies here before posting questions on this forum.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CS assignment with dynamic structs and memory allocation
    By arbitraryproc in forum C Programming
    Replies: 4
    Last Post: 10-21-2012, 05:35 PM
  2. problem with memory allocation and structs
    By Durango2011 in forum C Programming
    Replies: 0
    Last Post: 12-04-2011, 04:36 AM
  3. Dynamic memory allocation for structs passed to function
    By eXcellion in forum C Programming
    Replies: 18
    Last Post: 03-30-2011, 03:30 PM
  4. Structs and dynamic memory allocation
    By PaulCocaine in forum C Programming
    Replies: 3
    Last Post: 11-22-2010, 10:14 AM
  5. Memory Allocation and Structs
    By reversaflex in forum C Programming
    Replies: 7
    Last Post: 04-04-2008, 02:46 PM

Tags for this Thread