Week 1 C
===
###### tags: `2021-CS50`
## CS50 IDE
[ide.cs50.io](https://ide.cs50.io)
<font color="blue">IDE:</font> Intergrated DEvelopment Environment
<font color="blue">CLI:</font> Command Line Interface
<font color="blue">GUI:</font> Graphical User Interface
computer can only understand 0s and 1s.
So the program we write(source code), the computer can't understand,need compiler to machine code(0s and 1s).
<font color="blue">Compiler:</font> convert source code to machine code.
```flow
st=>start: input(source code)
e=>end: output(machine code)
op=>operation: Compiler
st->op->e
```
## CS50 IDE- CLI examples
test
```
make hello
```
run
```
./hello
```
<font color="blue">arguments:</font> inputs to functions.
in scratch:

in C:
```
X: print
O: printf
```
<font color="blue">printf:</font> print a formatted something or other.
```c=
printf("hello,world!");
```
+ notice:
double quotes: ```" "```
semicolon: ```;```
```flow
st=>start: input(arguments)
e=>end: output(side effects)
op=>operation: functions
st->op->e
```
<font color="blue">functions:</font> a programmed version of an algorithm, the implementation of an algorithm in code、software.
a side effect of a function is often something visual that happens on the screen, like text or audio.
```
return values, variables
```
it's not going to say it on the screen. It's gonna just pass it back to the programmer, so we can reuse whatever the output of the function was.
<font color="blue">library:</font> a code that someone else has written.
## string
In C, we have the complete flexibility over what we want to do.
In CS50, type to run the code, no quick button to play.
C is an old language, decades now old. So back then, everything was deliberate. User interface was not top priority,performance instead was, for instance.
But nowadays, ther are fancier intergrated development enviroments. ex: play button.
<font color="blue"> String:</font> a term of art in the programming world. A "string" is text/word/letter/paragraph/a page of text.
```c=
get_string("What is your name?");
```
"=" means,effectively, copy whatever is on the right, into whatever is on the left.
```c=
answer = get_string("What is your name?");
```
but we have to tell the computer in advance what type f variable we want.
```c=
string answer = get_string("What is your name?");
```
