This project demonstrates professional C programming practices through the implementation of a Stack Abstract Data Type (ADT) and its application in string reversal. The project showcases modular design, proper memory management, and robust error handling.
Stack-ADT-and-String-Reversal-C-Programming-with-Modular-Design/
├── src/
│ ├── dynamic_stack/ # Dynamic stack implementation
│ ├── static_stack/ # Static stack implementation
│ └── common/ # Shared utilities
├── include/ # Header files
├── tests/ # Unit tests
├── docs/ # Documentation
├── Makefile # Build configuration
└── README.md # This file
- Dynamic memory allocation
- Configurable stack size
- Comprehensive error handling
- Memory leak prevention
- Thread-safe operations
- Fixed-size character stack
- String reversal functionality
- Input validation
- Buffer overflow protection
- GCC compiler (version 7.0 or higher)
- Make utility
- Standard C library
# Build all components
make all
# Build specific components
make dynamic_stack
make static_stack
# Clean build artifacts
make clean./bin/dynamic_stack_demo./bin/string_reversal_demoStack* stack_create(size_t capacity)- Create new stackbool stack_push(Stack* stack, int value)- Push value onto stackbool stack_pop(Stack* stack, int* value)- Pop value from stackbool stack_is_empty(const Stack* stack)- Check if stack is emptybool stack_is_full(const Stack* stack)- Check if stack is fullvoid stack_destroy(Stack* stack)- Free stack memory
bool char_stack_push(char c)- Push character onto stackbool char_stack_pop(char* c)- Pop character from stackbool char_stack_is_empty(void)- Check if stack is emptybool char_stack_is_full(void)- Check if stack is fullvoid char_stack_clear(void)- Clear all stack contents
- Modular Design: Separate concerns with clear interfaces
- Error Handling: Comprehensive validation and error reporting
- Memory Safety: Proper allocation, deallocation, and bounds checking
- Code Quality: Consistent style, meaningful names, and documentation
- Testability: Unit tests for all major functionality
Run the test suite:
make test- Follow the established coding style
- Add unit tests for new functionality
- Update documentation as needed
- Ensure memory safety and error handling
Jaden Mardini - Computer Science Student
This project is for educational purposes.