Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C Programming Fundamentals

A comprehensive syllabus covering the core concepts of the C programming language, from basic data types to advanced memory management and file handling.


Unit 1: Introduction to C Basics

Learn the foundational concepts of the C language.

Topics Covered:

  • Data Types (1_data_types.c) - Primitive data types (int, float, char, double), type ranges, and size
  • Operators & Expressions (2_operators_expressions.c) - Arithmetic, logical, relational, and bitwise operators; operator precedence
  • Data Conversions (3_data_conversions.c) - Type casting, implicit and explicit conversions
  • Input/Output Statements (4_io_statements.c) - printf() and scanf() functions for console I/O
  • Header File (myvar.h) - Custom header for reusable code

Unit 2: Control Flow & Functions

Master decision-making and iterative structures, plus function fundamentals.

Topics Covered:

  • Decision Structures (1_decision_structures.c) - if, else if, else, and switch-case statements
  • Loops (2_loops.c) - while, do-while, for loops; loop control and nested loops
  • Jump Statements (3_jump_statements.c) - break, continue, and goto statements
  • Introduction to Functions (4_intro_to_functions.c) - Function declaration, definition, calling, and parameters
  • Storage Classes & Scope (5_storage_scope.c) - auto, static, extern, register; variable scope
  • Recursion (6_recursion.c) - Recursive function design, base cases, and stack behavior

Unit 3: Data Structures & I/O

Explore complex data organization and advanced input/output operations.

Topics Covered:

  • Preprocessor & Macros (1_preprocessor_macros.c) - #define, #include, conditional compilation
  • Arrays (2_arrays.c) - Single and multi-dimensional arrays, array initialization and manipulation
  • Strings (3_strings.c) - String handling, char arrays, string functions (strlen, strcpy, etc.)
  • Structures (4_structures.c) - Structure definition, initialization, nested structures
  • Unions (5_unions.c) - Union definition and usage; differences from structures
  • Standard I/O Functions (6_stdio_functions.c) - fgetc, fputc, gets, puts, and other stdio functions
  • Sample Files (data.txt, example.txt) - Example data files for I/O operations

Unit 4: Pointers & Algorithms

Deep dive into memory management and fundamental algorithms.

Topics Covered:

  • Pointers Basics (1_pointers_basics.c) - Pointer declaration, dereferencing, and address-of operator
  • Pointers & Arrays (2_pointers_arrays.c) - Array-pointer relationship, pointer arithmetic, arrays of pointers
  • Pointers & Structures (3_pointers_structures.c) - Pointers to structures, structure pointers, accessing members
  • Call by Value & Reference (4_call_by_value_reference.c) - Parameter passing mechanisms and function behaviors
  • Dynamic Memory (5_dynamic_memory.c) - malloc(), calloc(), realloc(), free(); memory allocation and deallocation
  • Searching Algorithms (6_searching_algorithms.c) - Linear search, binary search, and performance comparison
  • Sorting Algorithms (7_sorting_algorithms.c) - Bubble sort, selection sort, insertion sort, quick sort, merge sort

Unit 5: File Handling & OOP Concepts

Work with persistent data storage and introduce object-oriented principles in C.

Topics Covered:

  • File Handling Basics (1_file_handling_basics.c) - File operations, file pointers, fopen(), fclose()
  • File I/O Operations (2_file_io_operations.c) - fread(), fwrite(), fprintf(), fscanf(); text and binary file handling
  • OOP Concepts (3_oop_concepts.cpp) - Object-oriented programming principles and their application in C/C++

Learning Path

  1. Start with Unit 1 to build a strong foundation in C syntax and basic operations
  2. Progress to Unit 2 to learn program flow control and function design
  3. Move to Unit 3 to work with structured data types and I/O
  4. Study Unit 4 to master pointers and implement algorithms
  5. Conclude with Unit 5 to learn file handling and advanced concepts

Prerequisites

  • Basic understanding of programming concepts
  • A C compiler (gcc, clang, or MSVC)
  • A text editor

How to Use These Examples

Each file contains practical examples and exercises. To compile and run:

gcc filename.c -o output_name
./output_name

For more complex programs with multiple files:

gcc file1.c file2.c -o program_name
./program_name

Debugging with GDB

To debug your C programs using the GNU Debugger (gdb):

  1. Compile with debug symbols:

    gcc -g filename.c -o output_name
  2. Start gdb:

    gdb output_name
  3. Common gdb commands:

    • run or r: Run the program
    • break or b <line_number>: Set a breakpoint at a specific line
    • break or b <function_name>: Set a breakpoint at a function
    • next or n: Execute next line (step over)
    • step or s: Step into function calls
    • print or p : Print the value of a variable
    • continue or c: Continue execution until next breakpoint
    • backtrace or bt: Show the call stack
    • quit or q: Exit gdb
  4. Example debugging session:

    (gdb) break main
    (gdb) run
    (gdb) next
    (gdb) print x
    (gdb) continue

For more detailed information, refer to the gdb manual.


Additional Resources

  • Practice implementing variations of the provided examples
  • Write your own programs combining concepts from multiple units
  • Debug and optimize your code
  • Refer to the C Standard Library documentation for built-in functions

Happy Learning! 🎓

About

Example code for the programming fundamentals using C programming language.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages