Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Coding Test
- programmers
- 프로그래머스
- javascript
- c++
- 네트워크
- C
- network
- Kakao
- string
- TCP
- CS50
- 이더넷
- 프로그래밍
- logic gate
- 코딩테스트
- codingtest
- kakao coding test
- 메모리
- kakao입사
- Compiler
- English
- Ethernet
- CS
- DRAM
- 병렬 통신
- memory
- ram
- 논리게이트
- broardcast
Archives
- Today
- Total
Code Inside
CS50 - Week 1 본문
반응형
1) C
- C 언어를 배우는 것이 목표가 아니라 Program 을 배우기 위해 C를 알아보자.
- When we evaluate the quality of our code, we might consider the following aspects:
- correctness, or whether our code solves our problem correctly
- design, or how well-written our code is, based on how efficient and readable it is
- style, or how well-formatted our code is visually
- Our first program in C that simply prints “hello, world” to the screen looks like this:
#include <stdio.h> int main(void) { printf("hello, world\n"); }
2) IDEs
- 위의 code 를 컴퓨터가 실질적으로 실행할 수 있는 program 으로 바꾸기 위해서는, 첫번째로 우리는 binary 즉, 0 과 1 로 변환해야 한다.
- IDEs 라고 불리는, integrated development environments, 우리가 코드를 쓰고, 번역하고, 실행할 수 있는 기능을 포함하는 개발 환경이다.
인기 있는 IDE인 Visual Studio Code에는 텍스트 편집기 또는 일반 텍스트로 코드를 작성하고 파일에 저장할 수 있는 영역이 포함되어 있다.:
3) Compilers
- Now our source code, or code that we can read and write, is saved to a file called hello.c. Next, we need to convert it to machine code, or zeroes and ones that represent instructions that tell our computer to perform low-level operations.
A compiler is a program that can convert one language to another,
such as source code to machine code:
- Visual Studio Code, also referred to as VS Code, is typically a program that we can download to our own Mac or PC. But since we all have different systems, it’s easier to get started with a cloud-based version of VS Code that we can access with just a browser.
- VS Code interface 의 반쪽 아래는 terminal 영역이다. 이 영역에서 text commands 를 쓰고 실행할 수 있다.
VS Code terminal - This terminal will be connected to our own virtual server, with its own operating system, set of files, and other installed programs that we access through the browser.
- The terminal provides a command-line interface, or CLI, and it allows us to access the virtual server’s operating system, Linux.
- program 의 compile 을 위해 'make hello' command 를 실행한다. 아무 일도 일어나지 않지만, 'hello' 라는 파일이 생긴 것을 GUI 에서 확인할 수 있고, 그 파일은 ./hello 명령으로 실행된다.
- ./hello 명령어는 컴퓨터에게 현재 폴더(.)에서 hello 라는 파일을 찾고, 실행하라고 지시한다. 그럼 우리가 원하는 output 을 볼 수 있다.
- We’ll open the sidebar and see that there are two files in our virtual server, one called hello.c (which we have open in our editor), and one called hello:
- The make hello command created the hello file containing machine code.
- The sidebar is a graphical user interface, or GUI, with which we can interact visually as we typically do.
- To delete a file, for example, we can right-click it in the sidebar and select the “Delete Permanently” option, but we can also use the terminal with the rm command:
rm command - We run rm hello to remove the file called hello, and respond y for “yes” to confirm when prompted.
- We can also run the ls command to list files in our current folder. We’ll compile our file again and run ls to see that a file called hello was created:
- hello is in green with an asterisk, *, to indicate that it’s executable, or that we can run it.
- Now, if we change our source code to read a different message, and run our program with ./hello, we won’t see the changes we made. We need to compile our code again, in order to create a new version of hello with machine code that we can run and see our changes in.
- make is actually a program that finds and uses a compiler to create programs from our source code, and automatically names our program based on the name of the source code’s file.
from.
'Computer Science' 카테고리의 다른 글
[자료 구조] Big O - 알고리즘 속도 (시간복잡도), Algorithm Time complexity (0) | 2022.09.27 |
---|---|
[Network] TCP vs UDP 차이 (0) | 2022.09.22 |
CS50 - Week 2 (1) Compiling (2) | 2022.09.17 |
[Network] 2. 이더넷(Ethernet) (0) | 2022.09.12 |
[Network] 1. Network 기본 속성 (2) | 2022.09.11 |
Comments