카테고리

asm (27) bootloader_x86_grub (1) C (92) compile (11) config (76) CPP (13) CSS (1) debugging (7) gimp (1) Go (1) html (1) Java (1) JavaScript (1) kernel (19) LibreOffice (3) Linux system progamming (21) MFC (1) opencv (4) OpenGL (1) PHP (1) Python (4) qemu (29) shell (3) socket (7) troubleshooting (2) ubuntu18.04 (2) windows (1)

2018/12/20

C 연산자, 형변환, 단순 대입

1. 연산자 
 피연산자, 사칙연산, 연산자 우선순위, 연산자 결합 방향.

1.1 항의 개수
 단항 연산 : 연산자 우선 순위 높음
 이항 연산 : 우선순위, 결합방향
 삼항 연산 : 논리 

1.1.1 기호 
 단항 연산자 기호: ++, --, ()
 이항 연산자 기호: *, /, %, +, - 
 삼항 연산자 기호: 조건식 ? 참 : 거짓 

1.2 피연산 표현 
자료형 등장
자료형 종류: 정수, 실수 

1.3 특징
정수 : 소수점 이하 생략.

실수 : 연산시 오차범위 발생 
       숫의 표현이 넓어지면 그 만큼의 오차도 줄어들게 된다. 

2. 자료형의 강제 형변환 연산자 
2.1 연산자 종류
단항 연산자

2.1.1 기호 및 예약어 
(char), (int), (float)

2.2 특징
char 문자, int 정수, float 실수. 
자료형 마다, 같기 다른 인식과 해석.
인식과 해석을 강제로 변경을 한다. 
char 자료형을 int 자료형으로 강제변환.

2.3 자동 강제형 변환
컴파일러에 의해 자동으로 변환

2.4 수동 강제형 변환
프로그램에 의해 코드에서 변환
컴파일러에 옵션 처리를 통해 변환

2.5 추론
즉 개인의 경험이나 성향에 따라 사물을 인식하는 범위와 표현하는 해석은 다르다. 
경험이 많은 사람의 고정 관념으로 인식 범위를 넓혀 주고, 표현 방법도 넓혀준다.

3. 단순 대입 연산자 
3.2 기호 : =
쓰기 전용(Write) 

L_Value(RW) = R_Value(R)
               <--
      RW W_Mode R

3.2.1 사용 방법
정보 
변수(RW) = 정보(R)
      <--- 복제

메모리(RW) = 변수(RW) = 정보(R)
     자원<---복제<--복제

추론
변수: 정보의 변화는 변수에서 나온다.
      변수는 결국 새로운 세상을 만든는 근본이 된다.
  정형화된 변수: 학교 수업을 통해 얻어지는 다수의 생각
  비정형화된 변수: 모범적 답안이 아니라 생각하지 못하는 행동

  정형화된 사람: 보편적 행동
  비정형화된 사람: 예측할 수 없는 행동, 사회적 버그(성공 또는 실패)

4. 읽기 전용 변수 선언
4.1 키워드 예약어 
const 자료형 안정어 

4.2 사용방법.
const int information_valiable = 5;
ReadOnly 자료 변수 = 정보

정보 
변수(RW) = 정보(R)
      <--- 복제

메모리(RW) = 변수(RW) = 정보(R)
     자원<---복제<--복제

RMode <--- 메모리(RW) = 변수(RW) = 정보(R)
정보R <--- 자원<--------복제<------복제

C 형식 지정 문자 입출력 함수

형식 지정 문자
scanf(), printf()
F : format

1. 출력 형식 지정 함수
함수원형
int printf(const char *format [, argument], ...);

const? : 읽기 전용의 형 안정화, 상수선언
형식 문자 : %d, %ld, %s, %o, %s, %f, %p

character + integer = interger 자료형 선택 -> Integer promotion
    1byte + 4byte = 4Byte 자료형 선택 -> Integer promotion

자료형의 연산 정의: 자료형이 큰게 선택된다.

2. 입력 형식 지정 함수
함수원형
int scanf(const char *format [, argument], ...);

비쥬얼 스튜디오 단축키

솔루션 빌드: F7
프로젝트 빌드: F5(디버깅 정보 추가), Ctrl + F5(디버깅 없음)

에러코드 위치 이동: F4

브레이크 포인트: F9
단위별 실행 : F5 -> 다음 브레이크 이동
프로지서 실행: F10 -> 한줄 씩 실행(메모리 검사 확인)
디버깅 중지: Shift F5

우분투 사용자 화면설정

xrandr
Screen 0: minimum 320 x 200, current 3840 x 2160, maximum 8192 x 8192
HDMI-1 connected (normal left inverted right x axis y axis)

HDMI-1 connected 로 연결됨.

VEST CVT 해상도 정보 확인
cvt 3840 2160
# 3840x2160 59.98 Hz (CVT 8.29M9) hsync: 134.18 kHz; pclk: 712.75 MHz
Modeline "3840x2160_60.00"  712.75  3840 4160 4576 5312  2160 2163 2168 2237 -hsync +vsync

해상도 추가
sudo xrandr --newmode "3840x2160_60.00"  712.75  3840 4160 4576 5312  2160 2163 2168 2237 -hsync +vsync

디스플레이 적용
sudo xrandr --addmode HDMI-1  "3840x2160_60.00"

시작 적용.
vi ~/.profile
xrandr --newmode "3840x2160_60.00"  712.75  3840 4160 4576 5312  2160 2163 2168 2237 -hsync +vsync
xrandr --addmode HDMI-1  "3840x2160_60.00"


4096 2160 설정
cvt 4096 2160
Modeline "4096x2160_60.00"  760.00  4096 4432 4880 5664  2160 2163 2173 2237 -hsync +vsync

sudo xrandr --newmode  "4096x2160_60.00"  760.00  4096 4432 4880 5664  2160 2163 2173 2237 -hsync +vsync
sudo xrandr --addmode HDMI-1 "4096x2160_60.00"

듀얼 모니터.profile 생성된 정보 넣고 재 부팅시 문제 발생 할 수 있다.

우분투 실행 파일 등록

16.04
cd ~/bin/
vi write.sh
#!/bin/bash
~/bin/Write_test

~/.local/share/applications$ cat write.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=New Document - Stylus Labs Write
Icon=write.png
Path=/home/linuxlee/bin
Exec=Write_test
StartupNotify=false
StartupWMClass=Write
OnlyShowIn=Unity;
X-UnityGenerated=true

art +f 2
검색: Write_test
실행 아이콘 dock 고정

18.04 더블커맨더
vi ~/bin/bash/
#!/bin/bash
~/bin/doublecmd/doublecm

[Desktop Entry]
Encoding=UTF-8
Version=0.8.8
Type=Application
Name=New Document - Stylus Labs Doublecmd
Icon=doublecmd.png
Path=~/bin
Exec=doublecmd.sh
StartupNotify=false
StartupWMClass=doublecmd.sh
X-Desktop-File-Install-Version=0.8.8

해상도 VESA 규격 (cvt, gtf, dp등등) 제어 정리.

1. 터미널 열기
Ctrl + Alt + T

2. 현재 모니터 및 해상도 상태 확인
shell> xrandr
Screen 0: minimum 320 x 200, current 4096 x 2160, maximum 8192 x 8192
eDP-1 connected (normal left inverted right x axis y axis)
   1920x1080     60.01 +  59.97    59.96    59.93 
   1680x1050     59.95    59.88 
   1600x1024     60.17 
   1400x1050     59.98 
   1600x900      59.99    59.94    59.95    59.82 

2.1 모니터 확인
xrandr --verbose | perl -ne '
if ((/EDID(_DATA)?:/.../:/) && !/:/) {
  s/^\s+//;
  chomp;
  $hex .= $_;
} elsif ($hex) {
  # apt install read-edid package installed
  # grep search
  open FH, "|parse-edid";
  print FH pack("H*", $hex);
  $hex = "";
}'

2.1 드라이버 지원 모드 확인
최신 제공하는 커널과 그랙픽 관련은 항상 충돌이 있음 Nvida 같은 경우 문제가 존제.
cuda nvida 설치 방법으로 해도 문제가 발생.

최신 드라이버 보다나는 칩세과 맞는 드라이버 설치.
sudo apt-cache search nvidia | grep driver

설정이 끝나면 커널 재 빌드한다.
sudo update-initramfs -u

2.2 해상도 확인
3. VESA CVT 해상도 확인
3.1 VESA 정의
VESA (Video Electronics Standards Association)은 컴퓨터 디스플레이 규격 협회, 1988년 NEC에 의해 만들어 졌다. 현재 회원사는 225개.

최초의 규격 Super VGA, 이 후 VESA Local Bus, GTF, CVT, DP, EDID 등을 만듬. 현재 DP 포트는 HDMI와 경쟁.
VESA에서 만든 규격 중 성공한 것도 있지만 Plug & Display와 Digital Flat Pane과 같은 모니터 커넥터 규격은 DVI에 밀려 실패.

평면 벽걸이형 TV 장치 규격은 VESA에서 만든 VESA Mounting Interface Standard이다.

3.2 GTF 유틸
Generalized Timing Formula : 일반화 된 타이밍 공식
아날로그 VGA 디스플레이 인터페이스 의 컴포넌트 비디오 신호 의 정확한 파라미터를 정의 하는 VESA 의 표준
VGA(640 × 480), UXGA(1600 x 1200) 또는 HD720 (1280X720)과 같은 대부분의 비디오 해상도 규격

XFree86 Modeline
Flags (optional): +HSync, -HSync, +VSync, -VSync, Interlace, DoubleScan, CSync, +CSync, -CSync

Modeline "1600x1200" 155   1600 1656 1776 2048   1200 1202 1205 1263
#           (Label) (clk)     (x-resolution)        (y-resolution)
#                     |
#              (pixel clock in MHz)

shell> gtf 1024 768 60 -x

shell> gtf 1920 1080 60 -x

디바이스가 제공하는 값으로만 계산 함.

3.3 CVT 유틸
Coordinated Video Timing modes : 조정 된 비디오 타이밍 모드
아날로그 VGA 디스플레이 인터페이스 의 컴포넌트 비디오 신호 의 정확한 파라미터를 정의 하는 VESA 의 표준
VGA(640 × 480), UXGA(1600 x 1200) 또는 HD720 (1280X720)과 같은 대부분의 비디오 해상도 규격

shell> cvt 1600 900

사용자가 제정의 할 수 있음.

3.4 DP
Display Port
8채널 24비트/196khz Linear PCM 음성신호와 영상을 동시에 전송

3.4.1 소프트웨어 기반 모니터 포트 지정 방법.
a) 패키지 설치
shell> sudo apt install i2c-tools ddccontrol
shell> sudo apt install ddccontrol ddccontrol-db gddccontrol

b) 소스 기반 설치
shell> sudo apt install intltool
shell> git clone https://github.com/ddccontrol/ddccontrol-db.git
shell> cd ddccontrol-db
shell> ./autogen.sh
shell> ./configure --prefix=/usr/
shell> make

모듈 등록 확인
shell> cat /etc/modules-load.d/ddccontrol-i2c-dev.conf
# Load i2c-dev at boot to probe DDC/CI devices (displays)
i2c-dev

3.4.2 현재 사용중 모니터 확인
GUI
shell> sudo gddccontrol

CLI 기반
shell> sudo ddccontrol -p

Detected monitors :
 - Device: dev:/dev/i2c-5
   DDC/CI supported: No ---> 현재 LG 노트북
   Monitor Name: VESA standard monitor
   Input type: Digital
 - Device: dev:/dev/i2c-2 ---> 현재 사용중인 모니터
   DDC/CI supported: Yes
   Monitor Name: VESA standard monitor
   Input type: Digital
  (Automatically selected)
Reading EDID and initializing DDC/CI at bus dev:/dev/i2c-2...
I/O warning : failed to load external entity "/usr/share/ddccontrol-db/monitor/CND3200.xml" -> 아직 지원하지 않음.
Document not parsed successfully.
I/O warning : failed to load external entity "/usr/share/ddccontrol-db/monitor/CNDlcd.xml" -> 아직 지원하지 않음
Document not parsed successfully.

EDID readings:
Plug and Play ID: CND3200 [VESA standard monitor]
Input type: Digital
=============================== WARNING ===============================
There is no support for your monitor in the database, but ddccontrol is
using a basic generic profile. Many controls will not be supported, and
some controls may not work as expected.
Please update ddccontrol-db, or, if you are already using the latest
version, please send the output of the following command to
ddccontrol-users@lists.sourceforge.net:

LANG= LC_ALL= ddccontrol -p -c -d

Thank you.
=============================== WARNING ===============================

이 경고문은 ddccontrol 명령어에서 비표준 명령 및 값에 대한 설명을 인식하지 못해서이다.

여기서 참고해야 할 내용은
 - Device: dev:/dev/i2c-2
참고한 내용이다.

4.4.3 명령어 나열
shell> sudo ddccontrol -d dev:/dev/i2c-2
Controls (valid/current/max) [Description - Value name]:
Control 0x02: +/2/255 C [Secondary Degauss]
Control 0x04: +/0/1 C [Restore Factory Defaults]
Control 0x05: +/0/1 C [Restore Brightness and Contrast]
Control 0x08: +/0/1 C [Restore Factory Default Color]
Control 0x0b: +/50/65535 C [???]
Control 0x0c: +/70/170 C [???]
Control 0x10: +/50/100 C [Brightness]
Control 0x12: +/50/100 C [Contrast]
Control 0x14: +/11/11 C [???]
Control 0x16: +/68/100 C [Red maximum level]
Control 0x18: +/70/100 C [Green maximum level]
Control 0x1a: +/73/100 C [Blue maximum level]
Control 0x52: +/0/255   [???]
Control 0x60: +/3/3 C [Input Source Select - Digital]
Control 0x62: +/23/100 C [Audio Speaker Volume Adjust]
Control 0x6c: +/50/100 C [Red minimum level]
Control 0x6e: +/50/100 C [Green minimum level]
Control 0x70: +/50/100 C [Blue minimum level]
Control 0x8d: +/2/2 C [???]
Control 0xac: +/54000/65280 C [???]
Control 0xae: +/2400/65535 C [???]
Control 0xb2: +/1/8   [???]
Control 0xb6: +/3/4 C [???]
Control 0xc0: +/25/65535 C [???]
Control 0xc6: +/111/65535 C [???]
ioctl(): 그런 장치 혹은 주소가 없음
ioctl returned -1
Control 0xc8: +/18/65535 C [???]
Control 0xc9: +/1056/65535 C [???]
Control 0xca: +/2/2 C [???]
Control 0xcc: +/14/255 C [???]
Control 0xd6: +/1/4 C [DPMS Control - On]
Control 0xdc: +/4/5 C [???]
Control 0xdf: +/513/65535 C [???]
Control 0xff: +/0/1 C [???]

경고 무시 하고, 제어값 확인.
하나만 설명
Control 0x10: +/50/100 C [Brightness]
최대 밝기

4.4.4 밝기 값 확인
shell> sudo ddccontrol -r 0x10 dev:/dev/i2c-2
Reading 0x10...
Control 0x10: +/50/100 C [Brightness]

4.4.5 밝기 조정
shell> ddccontrol -r 0x10 -w 25 dev:/dev/i2c-2

조정 입력 값은 16진수와 10진수 입력이 가능하다.

4.4.6 모니터 입력 변경.
이 기능을 사용 하기 위해서는 지원하는 모니터를 구입하는게 좋다.
지원하는 모티터를 확인하기 위해서는
/usr/share/ddccontrol-db/monitor/CNDlcd.xml 에서 확인 한다.

입력 소스 주소 확인.
shell> sudo ddccontrol -r 0x60 dev:/dev/i2c-2

EDID readings:
        Plug and Play ID: DELA0D7 [DELL P2217H (VGA)]
        Input type: Analog

Reading 0x60...
Control 0x60: +/257/4626 C [Input Source Select]

변경 예제.
Value 15: DP
Value 16: mDP
Value 17: HDMI (MHL) 1
Value 18: HDMI (MHL) 2

DP 포트 선택
ddccontrol -r 0x60 -w 15 dev:/dev/i2c-2

4.4.7 DB에 없는 경우.
shell> sudo ddccontrol -r 0x60 dev:/dev/i2c-2

Control 0x60: +/3/3 C [Input Source Select - Digital] ---> 현재 사용 중인 모니터 정보 없음.
+/3/3 : 앞의 숫자 3 현재 모니터와 연결 위치 ---> 현재 사용 중인 모니터 정보 없음
앞의 3 값이 나중 다시 돌아가는 위치가 된다.

사용하고 있는 모니터가 있다면 OSD 모니터 기능중 자동 선택 비 활성화.

모니터 다른 컴퓨터의 vga 오는 신호를 사용하도록 전환 방법.
첫 번째 컴퓨터 : hdml 사용
두 번째 컴퓨터 : DP 사용


hdmi 0: ddccontrol -r 0x60 -w 0 dev:/dev/i2c-2
hdmi 3: ddccontrol -r 0x60 -w 1 dev:/dev/i2c-2
hdmi 2: ddccontrol -r 0x60 -w 17 dev:/dev/i2c-2
hdmi 1: ddccontrol -r 0x60 -w 3 dev:/dev/i2c-2

xml 매개변수 확인
file:///usr/share/doc/ddccontrol/html/apes02.html


Xorg 로그 확인
shell> vi /var/log/Xorg.0
모니터 시리얼 넘버 확인.

제품명 확인.
shell> sudo dmidecode -s system-product-name
11T750-GT58K


4.4.7 키 바이딩
#!/bin/bash
# switch-monitor-source
# This script is used for switching input sources between hdmi/vga/displayport
# for my DELL P2217H monitor test.
# It uses i2c-bus-by-monitor-serial script as a dependency.
# For your usage, you should edit the following in this script: TARGET_SERIAL (optional, if you
# want use your s/n as default), cases for your PNP_IDs, VALUEs for your monitor (I have described
# how to explore them here: https://askubuntu.com/a/1010096/795775) and possibly add additional keys
# for switching using them (for example, -h2 for hdmi2, -v2 for vga2).

if [[ $1 == "--help" ]]; then
echo -e "\
Usage:
switch-monitor-source [-s <serial_number>] [-i <i2c bus number>] [-p <Plug and Play ID>] -r|-u|-h|-v|-d|
-s - set serial number of your monitor which you want to control.
-i - needed when several monitors with same s/n were found. Otherwise is sets automatically.
-p - explicitly set PNP_ID instead of extracting from edid. For development needs.
-r - read current value for 0x60 command
-u - update cached i2c-id number. You need do this after every (?) reboot and after every (?) monitor
     replugging.
-h|-v|-d - switch input source of monitor to hdmi/vga/displayport
--help - print this help
Example:
switch-monitor-source -s 0G2TG7360DXB -u # update file with i2c-id for monitor with specified s/n
switch-monitor-source -s 0G2TG7360DXB -v # switch that monitor to vga input
"
exit
fi


if [[ $1 == "-s" ]]; then
TARGET_SERIAL=$2 # use passed s/n
shift; shift
else
:
TARGET_SERIAL="0G2TG7360EMB" # default s/n. change to your monitor's serial number
fi

if [[ `lsmod | grep i2c_dev` == "" ]]; then
echo "Probing i2c-dev module..."
sudo modprobe i2c-dev # you can add it permanently by running "i2c-dev >> /etc/modules"
else : echo "i2c-dev module was already probbed"
fi

CACHED_ID_FILE="/tmp/$TARGET_SERIAL.i2c-id.txt"

if #[[ /dev/i2c-`cat $CACHED_ID_FILE` -nt $CACHED_ID_FILE || $1 == "-u" ]]; then # TODO automatically check if need to update cached id
[[ ${!#} == "-u" ]]; then
echo `i2c-bus-by-monitor-serial -s $TARGET_SERIAL | tail -n1` > $CACHED_ID_FILE
echo -e "$TARGET_SERIAL is now on bus i2c-" "`cat $CACHED_ID_FILE`\n$CACHED_ID_FILE has been updated"
exit 0
fi

I2C_ID="-1"
if [[ `grep "and" $CACHED_ID_FILE` != "" ]]; then
echo "Warning! There are several i2c ids with the same monitor serial number!"
if [[ $1 != "-i" ]]; then
echo "Use -i to specify i2c id manually! Choose from `cat $CACHED_ID_FILE`"
exit 1
else
I2C_ID=$2 # manually specified if there are several ids
shift; shift
fi
elif [[ ! -f $CACHED_ID_FILE || ! -s $CACHED_ID_FILE ]]; then
echo "$CACHED_ID_FILE does not exist or is empty. Use -u to update/create it."
else
I2C_ID=`cat $CACHED_ID_FILE` # we got univocal id
fi

if [[ ${!#} == "-r" ]]; then # show current value for 0x60 command
echo "Going to read 0x60"
sudo ddccontrol -r 0x60 dev:/dev/i2c-$I2C_ID | grep "0x60"
fi

PNP_ID=`sudo ddccontrol -c dev:/dev/i2c-$I2C_ID 2>/dev/null | grep "Plug and Play ID:" | cut -f5 -d" "`
echo "PNP_ID=$PNP_ID"
VALUE=""
if [[ $1 == "-p" ]]; then
PNP_ID=$2
shift; shift
# echo "PNP_ID=$PNP_ID"
fi

case $PNP_ID in
"DELA0D7") # Dell P2217H over vga transport
case ${!#} in
"-h") VALUE=273 ;; # Switch to HDMI source
"-v") VALUE=257 ;; # Switch to VGA source
"-d") VALUE=271 ;; # Switch to DisplayPort source
esac
;;
"DELA0D9") # Dell P2217H over hdmi transport
case ${!#} in
"-h") VALUE=4369 ;; # Switch to HDMI source
"-v") VALUE=4353 ;; # Switch to VGA source
"-d") VALUE=4367 ;; # Switch to DisplayPort source
#"") # TODO count arguments and if zero, then
#echo "You have not specified a switch action"
esac
;;
esac

if [[ $VALUE != "" ]]; then
echo "Writing $VALUE to 0x60"
sudo ddccontrol -r 0x60 -w $VALUE dev:/dev/i2c-$I2C_ID 1>/dev/null
fi

# TODO maybe reprogramm on C language for more performance? This script takes about 3,1 seconds to switch input source,

텍스트
switch-monitor-source -s 0G2TG7360DXB -u # get and cache i2c-id number for monitor with specified s/n
switch-monitor-source -s 0G2TG7360DXB -v # switch that monitor to vga input
switch-monitor-source -s 0G2TG7360DXB -h # switch that monitor to hdmi input

3.5. EDID
EDID (Extended Display Identification Data)
모니터가 컴퓨터 자체에 대한 정보를 제공한다.
지원하는 해상도를 찾아서 읽고, 모니터 제공하는 헤르지 동기화.

EDID 정보를 읽을 수 없다면, 저해상도 디스플레이만 한다.
모니터 정보 확인
shell> lspci -vk | grep -iA20 vga

부팅 설정 확인
shell> vi /etc/default/grub

EDID 정보 확인.
sudo apt-get install get-edit edid-decode
sudo get-edid | parse-edid

4. HDMI
고선명 멀티미디어 인터페이스(High Definition Multimedia Interface, HDMI)
기존의 비디오 단자들과 달리 비디오, 오디오, 제어 등 멀티미디어 기기에서 필요한 모든 단자를 통합

C 문자 입출력 함수 나열.

1. 문자 입력 함수
getchar(), getch(), getche()

2. 문자열 입력 함수
2.1 gets(), gets_s();
2.2 scanf(), scanf_s()

3. 출력 함수
3.1 문자
 putchar();
3.2 문자열
 pust();
 printf();

C 문자열 간단한 이론 정리.

1. 문자
한 글자 숫자하나.
ASCII CODE.

2. 문자열
여러 글자 : 배열 char[5];

2.1 문자열 정보 입력 함수
함수 원형
char *gets(char *buffer);
char* gets(char* buffer);

char* : 반환 자료형
gets : 함수 이름, 식별자 Identifier
( : 인자 값 자료형 선언 시작
char*  : 인자(매개변수) 값의 자료형
buffer : 자료형의 이름, 식별자 Identifier
) : 인자값 자료형 선언 종료

                         기표 Buffer
문자열 표상 = --------------
                        기의 Memory

C 함수와 기본 입출력

1. 함수(函數)
'함'담을 '함'
담는 숫자 = Function.

발음이 비슷해 사용 함.
함수의 중국어 발음: han su

f(x) = y
y = (fx)
                       x
 ________\   /_
|                              |
|__   _________|
  /   \
    y

이러한 함수를 프로그램머가 사용하는 도구다.
이런 도구들 모여 원하는 내용물을 표현하며 프로그램이 되는 것이다.

원하는 용도에 맞게 함수를 합쳐 복합적 기능을 하는 프로그램을 만든다.

2. 기본 입출력 함수

2.1 include, lib
CRL : C Runtime Library
C언어 프로그램머들이 미리 만들어 놓은 함수들이다.

2.2 기본 입출력 장치
HID : Human Input Device

표준 입력 장치 stdin : 키보드, 마우스, 터치, 음성, 생체
표준 출력 장치 stdout: 모니터, 프로젝터, 프린터
표준 에러 장치 error: 파일로 만들수 도 있고, 모니터로 출력할 수 있음.

EOF = End of file 파일끝
문자 입력시 error -1 반환한다.

3. stdin 표준 입력
stding 키보드 장치 파일에 대한 입력 출력 file I/O BUFFER

3.1 함수의 원형
int getchar(void);

int : 반환 자료형
getchar : 함수의 이름, 식별자 -> Identifier
( : 인자 값 자료형 선언 시작
void : 인자 값의 형식이 없음
) : 인자값 자료형 선언 종료

4. stdout 표준 출력
모니터 정보 표시

4.1. 함수의 원형
int putchar(void)

int : 반환 자료형
putchar : 함수의 이름, 식별자 -> Identifier
( : 인자 값 자료형 선언 시작
void : 인자 값의 형식이 없음
) : 인자값 자료형 선언 종료

5. 대입 연산자
5.1 단순 대입연산자

Left Varue = Right Varue
좌항 =  우항

우황에 있는 값을 좌항에 대입한다.

6. 함수 동작
함수를 동작 시키기 위해서는 함수를 호출(call)한다.

f(x) = y
y = (fx)
           x = 입력 인자 값
 ________\   /_
|                              |
|      f()                   |
|__   _________|
  /   \
    y = 정보 반환 값

7 BUFFER
메모리의 연속된 공간.
연속된 공간에 정보를 담는다.

메모리 상의 버퍼를 못아 원하는 정보(영상, 음성)로 형식에 맞게 파일을 만든 후, 사람이 볼 수 있는 정보로 다시 표현해 컴퓨터에서 보여준다.

정보의 생성과 소비
정보의 생성자: 빅데이터, AI(머신 러닝, 딥러닝) 결국 정보 수집 후 사용자 요구에 따른 정보 분석 및 제공
정보의 소비자: 마케팅, 의료, 언어, 각종 산업군, 개인.

보안결합 Buffer Overrun