Lab 1: nyuc
Back to Operating Systems
Safe String Manipulation with Heap Allocation and Variadic APIs
Command Line Arguments
Example: Hello, world
About nyuc
Purpose: Demonstrates safe string manipulation with proper memory management.
Key Features:
- Heap allocation for argument copies (one malloc for char* vector, one per string)
- Variadic function
free_copied_args()for safe memory deallocation - Memory-safe transformation using
toupper()andtolower() - Validated with Valgrind: 0 memory leaks, 0 invalid accesses
Memory Discipline: Exact mirror of argv structure with NULL terminators, explicit resource ownership and release.
