Starting from:

$29

Homework #2 – Pointers and Dynamic Memory

EGRE 246 Introduction to Programming Using C
Homework #2 – Pointers and Dynamic Memory
Allocation
This homework must be your own (individual) work as defined in the course syllabus and
discussed in class.
1) Write a C program that reads in a list of letters, sorts them alphabetically and prints
them to the screen. The program must adhere to the following specifications:
a) The program must ask the user how many letters can be expected.
b) The program then should ask the user for all the (capital or lower-case) letters and
should make sure the letters entered are valid letters (and not symbols).
c) Capital letters should be sorted before lower-case letters.
d) Your program must use dynamic memory allocation for all arrays needed. In
addition, pointers must be used for all operations that access the array(s). Thus,
your program must not include any square brackets (‘[‘ or ‘]’) anywhere in the
code.
e) You program cannot allocate more memory than needed.
f) Your program must consist of a main()function, a sort(char *a, int
size) function, and a swap(char *x, char *y) function.
g) Any dynamic memory allocated must be freed before the program exits.
For this assignment, you must turn in a zip file with all of your C header files, source
code files, and a working Makefile to compile your solution. Turn in your assignment
by attaching the zip file to the assignment submission page.
Remember the class policy on late submissions – no late submissions are allowed
unless prior arrangement is made with the instructor.

More products