A comprehensive collection of C programming examples demonstrating various string, array, and object manipulation methods. Each method is implemented using both raw (manual) approaches and built-in library functions, organized by difficulty levels.
Phitron/Notes/
βββ String Methods/
β βββ Basic/ # Fundamental string operations
β βββ Intermediate/ # Intermediate string manipulations
β βββ Advance/ # Advanced string algorithms
βββ Array Methods/
β βββ Basic/ # Basic array operations
β βββ Intermediate/ # Intermediate array manipulations
β βββ Advance/ # Advanced array algorithms
βββ Object Methods/
β βββ Basic/ # Basic object operations
β βββ Intermediate/ # Intermediate object manipulations
β βββ Advance/ # Advanced object operations
βββ README.md
βββ .gitignore
This collection helps you understand:
- Raw Implementation: How to implement functionality from scratch
- Built-in Functions: How to use C standard library functions
- Performance Comparison: Differences between manual and optimized approaches
- Best Practices: When to use which approach
string_length.c- Calculate string length (raw vs strlen)string_compare.c- Compare two strings (raw vs strcmp)string_concatenate.c- Concatenate strings (raw vs strcat)string_copy.c- Copy strings (raw vs strcpy)string_reverse.c- Reverse string charactersstring_palindrome.c- Check if string is palindrome
string_count_characters.c- Count specific charactersstring_remove_spaces.c- Remove spaces from stringstring_sort_characters.c- Sort string charactersstring_substring_search.c- Find substring in stringstring_to_lower.c- Convert to lowercase (raw vs tolower)string_to_upper.c- Convert to uppercase (raw vs toupper)string_toggle_case.c- Toggle character casesstring_vowel_count.c- Count vowels in stringstring_word_count.c- Count words in string
string_anagram_check.c- Check if strings are anagramsstring_frequency_of_characters.c- Calculate character frequencystring_join.c- Join multiple stringsstring_remove_duplicates.c- Remove duplicate charactersstring_replace_substring.c- Replace substring in stringstring_split.c- Split string into tokens
array_length.c- Get array lengtharray_access.c- Access array elementsarray_search.c- Search elements in arrayarray_print.c- Print array elementsarray_sum.c- Calculate array sum
array_sort.c- Sort array elements (bubble sort vs qsort)array_reverse.c- Reverse array elementsarray_copy.c- Copy array elements (raw vs memcpy)array_max_min.c- Find maximum and minimum valuesarray_duplicate.c- Check for duplicate elements
array_merge_sort.c- Merge sort implementationarray_binary_search.c- Binary search algorithmarray_matrix_multiply.c- Matrix multiplicationarray_quick_sort.c- Quick sort implementationarray_rotate.c- Array rotation algorithms
object_create.c- Create objects (stack vs heap)object_access.c- Access object propertiesobject_compare.c- Compare objectsobject_copy.c- Copy objects (shallow vs deep)
object_array.c- Object array managementobject_sort.c- Sort objects by different fieldsobject_search.c- Search objects in collectionsobject_filter.c- Filter objects based on criteria
object_serialize.c- Object serialization/deserializationobject_hash.c- Object hashing and hash tablesobject_polymorphism.c- Polymorphic object behaviorobject_memory.c- Advanced memory management
- C compiler (GCC, Clang, or MSVC)
- Make (optional, for building)
# Compile individual files
gcc -o output filename.c
# Compile with all warnings
gcc -Wall -Wextra -o output filename.c
# Compile with debugging info
gcc -g -o output filename.c# Run compiled program
./output
# On Windows
output.exeEach file follows a consistent pattern:
#include <stdio.h>
#include <string.h> // or other necessary headers
// RAW METHOD - Manual implementation
return_type function_name_raw(parameters) {
// Manual implementation
}
// BUILT-IN METHOD - Using library functions
return_type function_name_builtin(parameters) {
// Built-in implementation
}
int main() {
// Test both implementations
// Compare results
return 0;
}- Stack vs Heap allocation
- Dynamic memory allocation
- Memory leaks prevention
- Memory pools
- Time complexity analysis
- Space complexity considerations
- Performance comparisons
- Arrays and dynamic arrays
- Linked lists (in object examples)
- Hash tables
- Stacks and queues
- Function pointers
- Polymorphism in C
- Serialization techniques
- Hashing algorithms
- Consistent naming conventions
- Clear comments and documentation
- Proper error handling
- Memory cleanup
- Test with various inputs
- Edge case handling
- Performance benchmarking
- Memory leak detection
- Raw Methods: Often more educational, may be less optimized
- Built-in Methods: Usually optimized, use standard library functions
- Memory Usage: Consider stack vs heap allocation
- Time Complexity: Understand Big O notation implications
- Follow the existing code structure
- Add comprehensive comments
- Include both raw and built-in implementations
- Test thoroughly
- Update documentation
This project is for educational purposes. Feel free to use and modify for learning.
- Start with Basic: Understand fundamental concepts
- Move to Intermediate: Learn optimization techniques
- Advance to Advanced: Master complex algorithms
- Compare Approaches: Understand trade-offs
- Apply Knowledge: Use in real projects
Happy Coding! π
This collection is designed to help you master C programming through practical examples and comparisons between different implementation approaches.