A collection of everything I learned during my lessons on C: small, focused programs that each demonstrate one core concept.
| File | What it covers |
|---|---|
Ascii Value of a Character |
Finding the ASCII value of a character |
append.c |
Appending data to an existing file |
creatingFiles.c |
Creating and writing files with file handling functions |
loopingThroughAnArray |
Iterating over the elements of an array |
maxOfThreeNums.c |
Finding the largest of three numbers |
struct.c |
Defining and using structures |
swap.c |
Swapping values using a function (pointers) |
swappingVariables.c |
Swapping two variables directly |
reverseNumber.c |
Reversing the digits of an integer using a loop, % and / |
- Variables, data types, and ASCII values
- Conditional logic (comparing numbers)
- Arrays and looping
- Pointers and functions
- Structures (
struct) - File handling (create, write, append)
A C compiler such as GCC or Clang.
gcc --versiongit clone https://github.com/Anujgiri1279/C.git
cd Cgcc swap.c -o swap
./swapOn Windows (MinGW):
gcc swap.c -o swap.exe
swap.exeReplace swap.c with any other .c file in the repo. For files without a .c extension, rename them to end in .c before compiling, for example:
cp "loopingThroughAnArray" loopingThroughAnArray.c
gcc loopingThroughAnArray.c -o loopingThroughAnArray
./loopingThroughAnArrayThis is a personal learning repository, but suggestions and improvements are welcome. Feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.
Anuj Giri (@Anujgiri1279)