Programming/C

C 언어란 / What is C language

옥뀨 2020. 7. 7. 02:19

본 포스팅은 필자의 개인적인 의견이 들어가 있다.

This post contains my personal opinion.

 

C 언어를 배우기에 앞서 C 언어란 무엇인가를 먼저 알아야 한다고 생각한다.

Before I learn C language, I think we should know what C language is.

 

C 언어가 세상에 나오기 전 1969년 켄 톰슨이 'B'라는 프로그래밍 언어를 만들었고 1972년

벨 연구소의 데니스 리치가 B 언어의 특징을 물려받은  'C' 언어를 만들었다.

Before the C language came out, Kenneth Lane Thompson created the programming language'B' in 1969,

and in 1972, Dennis Macalistair Ritchie at the Bell Labs created the'C' language,

inheriting the features of the B language.

 

데니스 리치 (출처 : 구글 검색) / Dennis Macalistair Ritchie (Source: Google Search)

 

C 언어가 만들어질 당시 어플리케이션 영역을 벗어난 운영체제를 어셈블리어가 아닌 언어로 작성한다는 것은 금기였다.

When the C language was created, it was contraindicated to write an operating system

outside the scope of the application in a language other than assembly language.

 

어셈블리어란 기계어와 일대일 대응이 되는 컴퓨터 프로그래밍의 저급 언어이다.

Assembly language is a low-level language of computer programming that has a one-to-one correspondence with machine language.

 

하지만 많은 유닉스가 C언어로 작성되기 시작하면서 그 당시 고수준 언어인 코볼, 포트란을 제치고 강력한 언어임을 입증했다.

However, as many Unix began to be written in the C language,

it proved to be a powerful language beyond the high-level languages of Cobol and Fortran at that time.

 

코볼 (출처 : 구글 검색) / COBOL (Source: Google Search)
포트란 (출처 : 위키피디아) / Fortran (Source:  wikipedia)

 

C 언어는 처음부터 어셈블리어와 비교할 만한 효율을 가지도록 저수준으로 설계되었다.

The C language was designed from the ground up to have a level of efficiency comparable

to assembly language.

 

C 언어의 초기 목적이 유닉스를 만들기 위함이기 때문이다.

This is because the initial purpose of the C language is to make Unix.

 

C 언어는 C++, java, python, C# 등의 객체 지향 언어와 다른 절차 지향 언어이다.

The C language is a procedural-oriented language different from object-oriented languages

such as C++, java, python, and C#.

 

그 말인 즉슨, 객체 지향 언어는 클래스, 메소드, 객체가 주가 되어 진행되고 C 언어는 절차에 의해 진행되며

포인터 변수라는 핵심이 있기에 하드웨어나 리눅스 운영체제를 다루는데 적합하게 되어 있다.

In other words, the object-oriented language is  composed of classes, methods, and objects,

and the C language is procedural and has the core of pointer variables,

making it suitable for handling hardware or Linux operating systems.

 

C 언어는 다른 객체 지향 언어들과 다르게 포인터 변수, 주소값을 이용해 참조를 하고 값을 변경한다는

점에서 객체지향 언어들과 차이가 있다.

The C language differs from other object-oriented languages in that it uses pointer variables and

address values to reference and change values, unlike other object-oriented languages.

 

프로그래밍 용으로 C 언어를 사용한다는 건 생각보다 효율이 좋지 않을 수 있다.

Using the C language for programming may not be as efficient as you might think.

 

왜냐하면 C 언어보다 프로그래밍 환경에 더 좋은 언어들이 많이 있기 때문이다.

This is because there are many better languages in the programming environment than in the C language.

 

C 언어를 제대로 사용하기 위해선  프로그래밍은 기본이고 어셈블리어 수준으로 프로그래밍을 해야 한다.

To use the C language properly, programming is basic and requires programming

at the assembly language level.

 

필자가 C 언어를 공부하는 이유가 바로 이것 때문이다.

That's why I study C.That's why I study C language.

 

시스템 보안에 있어선 C 언어는 절대적으로 필요한 언어라고 생각하기 때문이다.

This is because the C language is considered an absolutely necessary language for system security.

 

C 언어로 방대한 양의 코드를 함수, 구조체, 포인터, 매크로 만으로도 관리가 가능하다.

With the C language, a large amount of code can be managed only with functions, structures, pointers,

and macros.

 

특히 구조체라는 것은 리눅스 시스템에서도 굉장히 중요한 부분이다.

In particular, the structure is a very important part of the Linux system.

 

리눅스의 파일 시스템부터 명령어들까지도 구조체 형식으로 짜여져 있기 때문이다.

This is because Linux's file system and commands are also structured.

 

리눅스 파일 시스템 구조체 (1) (출처 : 구글 검색) / Linux file system structure (1) (Source: Google search)
리눅스 파일 시스템 구조체 (2) (출처 : 구글 검색) / Linux file system structure (2) (Source: Google search)

 

간단하게 C언어의 컴파일 과정을 사진을 통해 설명해보도록 하겠다.

I will briefly explain the compilation process of C language through pictures.

 

출처 : cafe.linuxmaster.co.kr (source : cafe.linuxmaster.co.kr)

 

소스 파일을 컴퓨터는 해석할 수가 없다.

the source file cannot be interpreted by the computer.

 

소스 파일을 기계어로 바꾸어 실행하는 파일까지 만들어 내는 과정을 컴파일 이라고 생각하면 되겠다.

You can think of compilation as the process of converting source files into machine language

and even creating executable files.

 

처음 C 언어 코드로 작성된 ".c 파일" 을 전처리기로 전처리 파일을 만든다.

First, In the ".c file" written in C language code, create a preprocessing file using the preprocessor.

 

전처리기란 c프로그래밍에서 제일 먼저 컴파일하는 프로그램이다.

The preprocessor is the first program to compile in c programming.

 

전처리기를 이용하여 각 코드 파일에서 지시자를 찾아 먼저 실행한다.

The preprocessor is used to find the Preprocessor Directives in each code file and execute it first.

 

여기서 말하는 지시자란 #으로 시작하는 줄을 의미한다.

The Preprocessor Directives here means a line starting with #.

 

지시자엔 "#include <stdio.h>", "#include <string.h>", "#define" 등이 있다.

Preprocessor Directives include "#include <stdio.h>", "#include <string.h>", and "#define".

 

전처리 파일이 만들어진 후 컴파일러를 통해 어셈블리 파일을 만든다.

After the preprocessing file is created, the assembly file is created through the compiler.

 

어셈블리 파일이란 기계어를 좀 더 이해하기 쉬운 쉬운 코드인 어셈블리어로 나타낸 파일이다.

An assembly file is a file expressed in assembly language,

which is easy code to understand machine language more easily.

 

그리고 어셈블러를 통해 라이브러리와 각종 함수를 종합한 오브젝트 파일이 생성된다.

Then, an assembler creates an object file that synthesizes libraries and various functions.

 

하나 이상의 오브젝트 파일을 가져와 이를 단일 실행 프로그램으로 병합하는 프로그램인 링커를

통해 실행파일이 생성된다.

An executable file is created through a linker,

a program that takes one or more object files and merges them into a single executable program.

 

그림에서처럼 실행 파일을 어셈블리 파일까지 읽어들이는 과정을 역어셈블 과정이라하며 기존 소스 복원까지

하는 과정을 디컴파일 과정이라고 한다.

As shown in the figure,

the process of reading an executable file up to an assembly file is called an disassemble process,

and the process of restoring an existing source is called a decompilation process.

 

이상 간단한 컴파일 과정에 대한 설명이었다.

It was an explanation of the simple compilation process.

 

C 언어를 배우고 다른 언어에 접근한다면 어렵게 접근하진 않을 거라 생각한다.

If you learn the C language and approach other languages, I think it will not be difficult.

 

이상 설명을 마치고 C 언어를 같이 배워보도록 하자.

After completing the above explanation, let's learn C language together.

'Programming > C' 카테고리의 다른 글

Linux C 프로그래밍 기초 ① / Linux C Programming basics ①  (0) 2020.07.15