SWEN-340

Struct Activity

Overview

This homework is to test your basic understanding of Structures in C

Setup

    Right click on the "Struct Activity zip file" link below and save the link address
    or save to your local folder.

    On any C language platform (such as terminal on a Mac, cygwin
    on a PC, or on any Linux or Unix platform) do the following:

    If running on nitron
    mkdir mydir
    cd mydir
    wget (paste the saved URL -- right mouse click)
    unzip struct_activity.zip
    To compile the program: gcc -o struct_activity -Wall struct_activity.c
    Then run it: ./struct_activity
    To retrieve your updated struct_activity.c and struct_activity.h files use
    WinSCP or sftp or other transfer utility.

    If running locally save the struct_activity.zip file to your local folder:
    To compile the program: gcc -o struct_activity -Wall struct_activity.c
    ./struct_activity

Submission

Submit your solution by pushing all files to your course repo by the deadline.

Grading

NOTE Each task listed below will be 2 points each. Points will be deducted for WARNINGS on compile!

1: Create a typedef of a struct in the header file

2: Add declaration for the PRODUCT_t static global in the C file

3: Try another way to add move_amount to x in the C file

4: Add declaration of PRODUCT_t for the stack based case in the C file

5: Add printf statements for both Global and Stack based PRODUCT_t in the C file

Struct Activity zip file