[gnome-university] [c101] Cleanup some chapter2 text.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-university] [c101] Cleanup some chapter2 text.
- Date: Mon, 5 Nov 2012 07:54:07 +0000 (UTC)
commit a0726f0a191f292844191659d60868624a177805
Author: Christian Hergert <christian hergert me>
Date: Sun Nov 4 23:53:58 2012 -0800
[c101] Cleanup some chapter2 text.
* Use single line per sentence.
* Cleanup the style of voice used.
c101/tex/chapter2.tex | 44 ++++++++++++++++----------------------------
1 files changed, 16 insertions(+), 28 deletions(-)
---
diff --git a/c101/tex/chapter2.tex b/c101/tex/chapter2.tex
index 1e6a517..e4c01e9 100644
--- a/c101/tex/chapter2.tex
+++ b/c101/tex/chapter2.tex
@@ -54,40 +54,28 @@ Chapter 2}
\begin{document}
\maketitle
-In Chapter 1, we learned the basics of what it is to write software in C,
-compile and execute our program. In Chapter 2 we will learn basic arithmetic,
-more about types, and how to input data from the command line.
-
-While planning this chapter it occurred to me that I should impart an important
-piece of knowledge. You, me, and everyone else will never be perfect at writing
-software or C. There is no such thing and it is an impossible dream. Software is
-a practice and we spend our entire lives improving our practice.
+In Chapter 1 we learned the basics of how to write software in C, compile and then execute our program.
+In Chapter 2 we will learn more about types, basic arithmetic, and how to read in text from the command line.
\section{Comments}
-Commenting code is very important. It allows you to leave clues to the next
-person that works on the code. There is a motto that you should always leave a
-place better than you arrived, and comments are a great way to do so.
-
-Comments in C are just plain text surrounded by \verb|/*| and \verb|*\|.
-Comments should be succinct and to the point. They should not simply be a
-statement of what you are doing, but \emph{why} you are doing it.
+Comments are a way for you to leave clues and notes to the next person working on that code.
+A good comment is clear and concise and explains not \emph{what} you are doing but \emph{why} you are doing it.
+A comment that only repeats what is clearly legible by reading the source code is not very useful.
+Even worse is a comment that is inaccurate because the code has changed but the comment was not.
-Comments can be placed on multiple lines as long as they are surrounded by
-\verb|/*| and \verb|*/|.
+Comments in C are plain text surrounded by \verb|/*| and \verb|*/|.
+They can cover one or more lines of the file and can stylistically differ from author to author as much as any art.
+Take a look at a few of the examples below to see how and where comments can be placed.
\begin{code}{}
-/* This is a comment */
-
-/* So is this.
- */
-
-/*
- * This too is a comment.
- */
-
-int a = 42; /* Comments can go at the end of lines */
-int b /* or in between */ = 42;
+/* A single line comment. */
+/* A
+ multi-line
+ comment. */
+int a = 42; /* A comment at the end */
+int b /* or the middle */ = 42;
+/* or the beginning */ int c = 42;
\end{code}
\section{Arithmetic}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]