Without Any Prior Coding Experience Class Notes
## 1. Introduction to C
**C** is a general-purpose programming language used to build
operating systems, embedded systems, utilities, games, and high-
performance applications.
### Why learn C?
* Builds strong programming fundamentals.
* Gives you an understanding of memory and how computers work.
* Forms a foundation for C++, C#, Java, and many other languages.
* Widely used in embedded systems and systems programming.
* Helps develop problem-solving skills.
### Basic C program
```c
#include <stdio.h>
int main(void) {
printf("Hello, World!\n");
return 0;
}
,```
### What each part means
* `#include <stdio.h>` — includes the standard input/output library.
* `main()` — starting point of the program.
* `printf()` — displays text.
* `\n` — moves to a new line.
* `return 0;` — indicates successful program completion.
* `;` — terminates a statement.
---
# 2. Setting Up a C Environment
You need:
1. A text editor or IDE.
2. A C compiler.
3. A terminal/command prompt.
Popular compilers include **GCC**, **Clang**, and **MSVC**.
With GCC, a program can commonly be compiled with:
```bash
,gcc program.c -o program
```
Then run:
```bash
./program
```
On Windows, the executable may be:
```bash
program.exe
```
### Compile vs. run
**Compile:** Convert C source code into executable machine code.
**Run:** Execute the resulting program.
---
# 3. Variables
A variable stores data that a program can use.
, ```c
int age = 25;
double price = 19.99;
char grade = 'A';
```
### Common data types
| Type | Purpose | Example |
| -------- | --------------------- | ---------- |
| `int` | Whole numbers | `42` |
| `float` | Decimal numbers | `3.14f` |
| `double` | More precise decimals | `3.14159` |
| `char` | One character | `'A'` |
| `_Bool` | True/false | `1` or `0` |
Example:
```c
int students = 30;
double temperature = 24.5;
char initial = 'L';
```
---