CSC161 2010F Imperative Problem Solving
[Skip to Body]
Primary:
[Front Door]
[Schedule]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
-
[Assignment]
[Lab]
Groupings:
[EBoards]
[Assignments]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
This outline is also available in PDF.
Held: Monday, 6 September 2010
Summary: We continue our explorations of the basic design of C, focusing on types in C.
Related Pages:
Notes:
Overview:
Let's explore how one turns the K&R Hello World
program into
something that meets the GNU coding standards.
#include <stdio.h> main() { printf("hello world\n"); }
cc flags files
cc file.c
a.out
.
-Wall
flag.
cc -Wall file.c
splint
splint file.c
cc
instructions above calls the executable
a.out
. What if you want a different name? You use the
-o outfile
command line parameter.
cc -Wall -o executable file.c
compile a C file and use the prefix of the C file as the name of the executableis so common that there's an automated way to do that.
make file
-Wall
flag. You can tell it to do so by adding an appropriate flag to the
command line.
make CFLAGS=-Wall file.c
Makefile
.
CFLAGS=-Wall
make file
main
.
main
is declared to return a value.
EXIT_SUCCESS
or EXIT_FAILURE
<sysexits.h>
less /usr/lib/sysexits.h
exit (CODE)
as the last line of
main
.
stdlib.h
to use exit
.
Variable Names
Declarations
type name;
Assignment:
variable = expression;
Primary Types
char
, int
,
short
, long
,
float
, and double
, along with a few
variations of those types.
<limits.h>
char
, int
, and
double
Enums
enumeratedtypes: Types whose values appear to be symbolic.
enum name { VAL0, VAL1, ..., VALN };
enum name var;
And More
[Skip to Body]
Primary:
[Front Door]
[Schedule]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
-
[Assignment]
[Lab]
Groupings:
[EBoards]
[Assignments]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Wed Dec 8 10:57:01 2010.
The source to the document was last modified on Fri Aug 13 15:41:47 2010.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CSC161/2010F/Outlines/outline.06.html
.