이번에는 Pset 2 풀기전에 section을 먼저 듣고 가겠습니당
저번에 section 안 듣고 pset 먼저 하다가 진짜 머릿속에 ???가 한가득이었기에...
이번에도 중복되는 것 제외하고 중요하다고 생각되는 것들만 정리해볼게용!
1. Array
Q. How do we create an array?
A.
ⓐ Name
ⓑ Size
ⓒ Type (a single type of data)
Ex) int nights [5] = {7, 8, 6, 7, 8};
ⓒ ⓐ ⓑ
Q. Can you change the size of an array?
A. You can't change the size of an array in C.
Q. Can an array exist on multiple planes, like a 3D array for instance?
A. There can be an array that actually contains arrays inside of itself.
Q. Let's say we have an array of five elements. Could we add only three and later on add the other two?
A. Yes, you could.
<Practice> - Doubling Up
Creating an array of integers in which each integer is 2 times the value of the previous integer.
☆ A phrase is an array of characters !
<Practice> - Alphabetical
2. Command-line Arguments
→ When we run mario, we didn't give any input - just ./mario
int main (void) : this function takes no arguments.
→ We can change our C code to take some input now. (int argc, string argv[])
If we type ./mario 8 in the terminal : argc = 2(inputs),
argv[0] = ./mario,
argv[1] = 8
☆ argc = the number of inputs to our program at the command line
☆ argv[] = the array of strings, the array of inputs to our program at the command line
'CS50' 카테고리의 다른 글
[CS50] Week 3 Review (1) | 2024.10.01 |
---|---|
[CS50] Pset 2 : Scrabble, Readability, Caesar (1) | 2024.09.29 |
[CS50] Week 2 Review (2) | 2024.09.23 |
[CS50] Week 1 Section + Pset 1 : Mario-more (0) | 2024.09.15 |
[CS50] Pset 1 : Credit (1) | 2024.09.13 |