Ass 2
Ass 2
Assignment # 2
Deadline Sunday Oct 12, 2024, Midnight (See GitHub Submission Instructions Below)
(1) Write a simple C program that demonstrates the use of pointers and structures to represent
different types of vehicles (like cars, trucks, and vans). This program also contains a memory
error that you can detect using Valgrind (as discussed in the class). Details should be as under:
(2) You need to implement an Animal struct with the associated functions demonstrates how to
manage dynamic memory in C. By incorporating proper memory management techniques
and using Valgrind, you can ensure that your code is free from memory leaks and that you
safely manage allocated memory.
1. Define Animal struct with properties such as name and age. The name will be
dynamically allocated.
2. Implement the three functions:
3. Write down the main function where call the above functions. The output will be look
like as follows:
4. Submit a memory leak report using valgrind – freeing memory without any leak will
carry significant weight.
This is the GitHub link to submit Ass 1: https://classroom.github.com/a/l2r-_95G
Step 1: Click on the above link if you already have a GitHub account, if NOT create your own
GitHub account, then click on the above link and join the classroom.
Step 2: After opening the link above accept the test Assignment.
Step 3: Click on the newly appeared GitHub link and see the attached PDF.
Step 4: Upload your C program on GitHub using the Add file tab.