---
# System prepended metadata

title: Getting Start

---

# Getting Start

## Git Bash 

### Windows
1 . Go to [git bash](https://gitforwindows.org/) and install it .
![](https://i.imgur.com/ItetSCN.png)

2 . Run the setting with following settings
* add an entrance on desktop
![](https://i.imgur.com/uPbrd7S.png)
* let the python can be run in git-bash too
![](https://i.imgur.com/MYTE9Cn.png)

3 . There will be an icon on desktop , click and run it

![](https://i.imgur.com/E5owLMQ.png)


### Mac

1 . type `gcc` on the terminal to check if gcc exist 
```clike
$ gcc
```
2 . If not exist click install on the popped window

3 . Keep clicking agree to finish install .

4 . type `gcc` again to check

5 . Now you can use the terminal to compile the program
[Turtorial](https://www.cs.auckland.ac.nz/~paul/C/Mac/)

## Sublime
![](https://i.imgur.com/KUwOgZE.png)

Choose your the version that match your operating system 
[Sublime Download](https://www.sublimetext.com/download)

### Creating a .c file
* File > new File > save file
* **When saving the file , set the name as example.c**
* Start writing your program !
 
![](https://i.imgur.com/RBpmRNZ.png)




## Basic Command

The command is same in Windows and Mac .

### Path
Each work-place has a specific path , we called it pwd .

#### Example
If we are at `root/`
```graphviz
Digraph G{
    node[shape = box]
    root->Desktop->"C-begin"
    
    rankdir = LR
}
```
`C-begin/` is in `Desktop/` ,`Desktop/` is in `root/` , so the *pwd* for each is 
* C-begin :  `root/Desktop/C-begin/`
* Desktop : `root/Desktop/`
* root : `root/`

If we are at `Desktop/`
```graphviz
Digraph G{
    node[shape = box]
    Desktop->"C-begin"
    rankdir = LR
}
```
`C-begin/` is in `Desktop/` ,`Desktop/` is in `root/` , so the **pwd** for each is 
* C-begin :  `Desktop/C-begin/`
* Desktop : `Desktop/`
* root : can't reach

We can't reach the `root/` , since `Desktop` is the file under `root/` . Note that the **pwd** of `C-begin/` and `Desktop/` changed , it is because **pwd** here is relative **pwd** (相對路徑).


![](https://i.imgur.com/SnUhk6s.png)

We can get the absolute **pwd**(絕對路徑) on the command line or the title of the window .
### ls
Show all the files in the current workplace .
![](https://i.imgur.com/Ejy04WZ.png)

### cd
**Format**

```clike
$ cd "path"
```
According the path  , change the work-place to the specific work-place , the path here must use the relative **pwd** .

```clike
$ cd Desktop/
```
![](https://i.imgur.com/huaWsu1.png)

```clike
$ cd Desktop/C-begin
```
![](https://i.imgur.com/QeKQPTY.png)

And we can also reach the upper file by 
```clike=
$ cd ..
```
![](https://i.imgur.com/XbqMng8.png)

### mkdir

### gcc
Here is an example program
```clike=
#include <stdio.h>

int main(int argc, char const *argv[])
{
	printf("Hello i am example\n");
	return 0;
}
```
To compile the program , we use 
```clike
$ gcc example.c  -o example
```
Which create an `example.exe` in the current workplace .
![](https://i.imgur.com/xYCI4w6.png)

To execute the program (.exe file), we type 
```clike
$ ./example
```

Results 
```clike
Hi i am example
```

## The Map of Computer Science

[click me](https://www.youtube.com/watch?v=SzJ46YA_RaA)

### Coding Language
* **C**
    * suitable for any hardware
    * faster speed 
    * use in chip , operating system ...etc
* **C++**
    * similar as C
    * object oriented
    * use in computer games , simulations ....etc
* **Python**
    * modern coding language
    * easier to learn
    * can easily code out a program
    
Coding is just like painting , the concept is more important than your technique . A good concept helps you to reach the top !
### Goal
From C to python , C++ , Java ..... all !
