This repository contains basic programs written in the C programming language. It's intended as a learning resource for beginners who are just starting to learn C.
- Hello World: A simple program that prints "Hello, World!" to the console.
- Variables and Data Types: Programs demonstrating the declaration and use of variables, as well as different data types in C.
- Input and Output: Examples of taking input from the user and displaying output using
printf()
andscanf()
. - Operators: Demonstrations of arithmetic, relational, logical, and bitwise operators in C.
- Control Structures: Examples of if-else statements, switch-case statements, and loops (for, while, do-while).
- Functions: Programs showcasing the creation and use of functions in C.
- Arrays: Examples of single-dimensional and multi-dimensional arrays, along with array manipulation.
- Pointers: Programs demonstrating the use of pointers in C, including pointer arithmetic and dynamic memory allocation.
- Strings: Examples of string manipulation, including string input/output, string concatenation, and string comparison.
- Structures: Demonstrations of creating and using structures in C.
To run these programs, you need a C compiler installed on your system. Below are the instructions for Windows (using Visual Studio Code) and Linux:
- Install Visual Studio Code (VS Code) from the official website.
- Install the C/C++ extension for Visual Studio Code, which provides IntelliSense, debugging, and code browsing support for C/C++.
- Install GCC (GNU Compiler Collection) using your package manager. For example, on Ubuntu, you can install it with the command:
sudo apt-get install gcc
-
Clone the repository:
git clone https://github.com/GamerzUnite/C-Basics.git
-
Open Visual Studio Code and navigate to the directory containing the program you want to run.
-
Open the program file (e.g.,
hello_world.c
) in Visual Studio Code. -
Press
Ctrl + Shift + B
to open the command palette and select the appropriate build task (e.g.,C/C++: gcc.exe build active file
). -
Once the program is built, you can run it by pressing
F5
or selectingRun > Start Debugging
from the menu.
-
Clone the repository:
git clone https://github.com/GamerzUnite/C-Basics.git
-
Navigate to the directory containing the program you want to run.
-
Compile the program using GCC. For example, to compile
hello_world.c
:gcc hello_world.c -o hello_world
-
Run the compiled executable:
./hello_world
Feel free to contribute to this repository by adding more basic C programs or improving existing ones. Just fork the repository, make your changes, and submit a pull request.
This repository is licensed under the MIT License.