Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
プログラム解説
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Yokoyama
September 20, 2021
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
プログラム解説
Yokoyama
September 20, 2021
More Decks by Yokoyama
See All by Yokoyama
C言語LT
2110
0
140
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.9k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
310
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Optimising Largest Contentful Paint
csswizardry
37
4k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
Utilizing Notion as your number one productivity tool
mfonobong
4
590
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
240
Making Projects Easy
brettharned
120
6.7k
Between Models and Reality
mayunak
4
450
エンジニアに許された特別な時間の終わり
watany
108
250k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Transcript
プログラムを記述するにあたって 高級言語 低級言語 (高水準言語) (低水準言語) VS VS ダークライ
低級言語 ・機械語(2進数),アセンブリ言語 ・コンピュータが理解しやすい言語。 CPUに依存したプログラムを作る必要がある ・プログラムの実行速度は早い ・「低級」とは「より低い次元での」という意味 →メモリ管理やI/O制御など、コンピューターの細かい動作まで記述する必要がある
高級言語 ・C言語,Java,Pythonなど ・人間が理解しやすい言語。互換性、移植性があり、開発の現場でよく利用される ・機械語に翻訳(コンパイル)する必要があるので低級言語よりも実行は遅い ・実行する際の細かな処理は省かれる →メモリ管理、IO制御などの操作は無視できる
そして我らがC言語 ・高級言語の仲間 ・OSの一つであるUNIXを記述する目的で開発された ・ほとんどの機能がC言語で記述されたライブラリによって提供される ・メモリ管理やビット毎の論理演算などの機能を持つ →移植性が高い →低級言語……?
そして我らがC言語 ・OS開発のために作られた ⇒ 低級言語と似たことができる高級言語 ・機械語チックな記述 ⇒ 記述量が多く面倒 →しかし、この仕様のおかげで汎用性が高い →プログラミングをしながらコンピューターの仕様も知ることができて一石二鳥
“Hello, World!” ・Python ・Java Script print("hello, world!") console.log("Hello, world!"); ・PHP
<?php print("Hello, world!"); ?>
“Hello, World!” ・C言語 #include <stdio.h> int main(void) { printf("Hello, World!\n");
return 0; }
文字を出力する int main(void) { return 0; } <メイン関数> ・一番最初に読み込まれる関数。こいつがいないと何も始まらない ・(void)
は「無」という意味 →引数の指定をしていないので戻り値が型なし ・『return』はプログラム終了の合図。 0を返せば正常終了、1を返すと異常終了
文字を出力する #include <stdio.h> <疑似命令> ・#include <ファイル名> プリプロセッサという。 ・指定したヘッダファイルの中身をコピペする役割 →このファイルの中に関数の定義などが書いてある ・今回の #include
の他にも、値に名前をつけられる #define など、いろいろな種類がある 「おまじない」なんて言わせない ・<stdio.h>(これで「スタンダードIO」と読む)には基本的な関数の定義が書かれている
文字を出力する printf("Hello, World!\n"); <printf関数> ・printf(“ 出力したい文字 ”); ・\n(もしくは ¥n )は改行を意味する
→エスケープシーケンス(特殊な文字の入力) ~エスケープシーケンス~ ・\n → 改行 ・\t → 頭揃え(水平タブ) ・\¥ → 文字としての¥ ・\! , \? → 文字としての!,? ・\’ , \” → 文字としての ’ ,”
数字を扱う printf("12345"); <文字列リテラル> ・printf内の ″ ″ で囲まれたものは、数字であっても文字扱いになる ・計算させるためには「数値」が必要 →「文字」扱いの数字では不可能 ⇒そうだ、指定子を使おう
数字を扱う printf("%d", 100); <出力変換指定子> ・外部のデータを文字列に変換したいときに使う ・%d は整数値を文字列に変換する →複数個を同時に使うこともできる printf("%d+%d=%d", 1,
1, 2);