SlideShare a Scribd company logo
1 of 13
Download to read offline
注意点(エラーに関すること) 
もう、いい加減私の名前覚えてよね!
小文字は小文字、大文字は大文字 
関数であれ、変数であれ、配列であれ、ソースコードの中では小文字 と大文字は違うものとして扱われます。 
int Arakinとint arakinでは別の変数なのです!
スペース 
a = b; などは見やすいようにスペースを入れているので無くても動作します。 
しか~し、return 0; の 0 とreturnの間のスペースは無いとエラーになります。
; セミコロン 
変数の宣言や関数の後ろには必ず ; セミコロンがつきます。 
ただし、forやifのような制御構文の括弧の後ろにはつかないので注 意!!
{ } 中括弧 
制御構文では必ず{ }で閉じないとエラーになります。ちゃんと1つの { に対応する } があるか確認して下さい。
文法 
文法が間違っていたらコンパイラが理解できません。文法があってい るか確認しましょう。
打ち間違い 
よくあります。でもこれは書き写したり自分の頭で考えない時ほど多 いです。 
よく考えてプログラムを作成することも大事です。間違えを探すのを 習慣にするよりミスを減らす努力を習慣づけてください。
指定した数や文字はあっているか? 
変数名を途中で変更した場合、どっかで変更前の変数になっていない か? 
コレ以外にも変数の型とprintfの変換指定は対応しているか?など
コードはすべて半角 
printf の括弧内の文字やコメントなど、コードとは関係ない場所では全 角を使うこともできますが、printf の括弧内でも¥nや%d等の制御コー ドや他の殆どの箇所ではすべて全角禁止です。 
判断が着かないならいっそある程度わかるまで全部半角で書いたほう が懸命かもしれません。
宣言はいつもひとつ!! 
同じ関数内で同じ変数の宣言をいくつも書いたらだめだよ。別の関数 内だったり変数自体をいくら使ってもかまわないけどさ~。 
あとmain関数は常に1つだけしか存在できないんだよ。なぜなら、 main関数もまた変数型の指定から始まるmainという関数の作成をして いる形になっているからなんだ。
エラーをよく見ろ 
なんか実行できない。じゃなくて、デバッグしてエラーになった時は どこがおかしいのかコンパイラの分かる範囲で表示されます。 
何行目に;が無い、とかmainの}を閉じてないなど、エラーをよく読 んだ上で対処してください。何のためにエラーかわかりません。 
そもそもエラーはプログラミングをしていれば日常茶飯事です。 エラーが全く出ず、一発で通る方が珍しいです。 
エラーやそのときの対処には慣れるようにしてください。 正直、エラーを起こさないための一番の近道かもしれません。 
なにもエラーが多いからと言ってプログラマの優劣は決まりません。
補足:Visual Studioのエラーの見方 
ここをクリックするとエラーについて 
書いてある。 
詳しくはファイル“Visual Studioの使い方”を参照すること。
ビルドするファイル以外はすべて閉じてからビルド 
ビルド(コンパイルして実際に動作させる)するときはほかのファイ ルをすべて閉じないとそれらのファイルも全部コンパイルして結果的 にmainが2つあるとかでエラーになります。 
ただし、これは使っているソフトウェア(Visual Studio)に依存(ほか のソフトなら必ずしも必要ない手間)しているもので、1年の後期の 授業では1つずつコンパイルしてくのでこの作業は必要ないはずです。 
自分にあったソフトを使うこともまた、ストレス無くプログラミング を行う近道かもしれません。 
統合開発環境ソフト(IDE)はVisual StudioのほかにもEclipse、Emacs(学校で使うがあくまでテキストエディタとしてのみ)、WideStudioな ど幾つも存在する。因みに筆者はVisual Studioがきらなにをするやめr

More Related Content

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

プログラミングにおける注意点(エラーに関すること) - マルチメディア研究同好会