l922 - Oxford University Computing Services Programming in...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Oxford University Computing Services Programming in C Languages l9.2/2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Typographical Conventions Listed below are the typographical conventions used in this guide. Names of keys on the keyboard are enclosed in angle brackets; for example <Enter> represents the Enter (or Return) key. Two key names enclosed in angle brackets and separated by a slash (for example, <Ctrl/Z>) indicate that the first key should be held down while the second is pressed; both keys can then be released together. Where two or more keys are each enclosed in separate angle brackets (for example, <Home><Home><Up arrow>) each key in the sequence should be pressed in turn. Characters typed in by the user are in lower-case non-bold characters in typewriter font. Other options and button names are shown in lower-case non-bold characters in typewriter font. Pull-down menu options are indicated by the name of the option enclosed in square brackets, for example [File/Print] . To select the option [Print] from the [File] menu: click with the mouse button on the [File] menu name; move the cursor to [Print] ; when [Print] is highlighted, click the mouse button again. Where menu items or large sections of output are included, they are shown as they would be displayed on the screen. Sections marked with a ‡ are more advanced and can be omitted on a first reading.
Background image of page 2
October 1996 OUCS Programming in C l9.2/2 Contents 1 Introduction 1 1.1 About this Userguide 1 1.2 Why use C? 1 2 An Example C Program 2 3 Variables and Expressions 3 3.1 Variable Declaration 3 3.2 Variable Types 3 3.3 Variable Names 4 3.4 Assignment 5 3.5 Arithmetic Operators 6 3.6 Increment and Decrement Operators 7 3.7 Cast Operators 7 3.8 Bitwise Operators ‡ 7 3.9 Promotions and Conversions ‡ 8 3.10 Parsing Rules ‡ 10 3.11 Symbolic Constants and The Preprocessor 11 4 Input and Output 11 4.1 Formatted Output — printf 11 4.2 Conversion Specifiers 12 4.3 Literal Constants 13 4.4 Formatted Input — scanf 15 4.5 Character I/O — getchar & putchar 16 4.6 End-of-File 17 5 Flow of Control 17 5.1 Relational and Logical Operators 17 5.2 Conditional Branching — if 18 5.3 Conditional Selection — switch 19 5.4 Iteration — while , for 20 5.5 Local Jumps — goto 21 5.6 Short Circuit Behaviour ‡ 22 5.7 Problems 22 5.8 Declaring Array Variables 23 5.9 Initialising Array Variables 24 6 Functions 25 6.1 Building Blocks of Programs 25 6.2 Return Value 25 6.3 Function Parameters 25
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
OUCS October 1996 6.4 Variable Function Parameters 26 6.5 Function Definition and Declaration 26 6.6 Function Prototypes 27 7 Scope, Blocks and Variables 28 7.1 Blocks and Scope 28 7.2 Variable Storage Classes ‡ 29 7.3 Declaration versus Definition 29 7.4 Initialisation of Variables ‡ 30 8 Arrays, Pointers and Strings 31 8.1 Pointers are Addresses 31 8.2 Pointers are not Integers 31 8.3 The * and & Operators 31 8.4 Declaring Pointer Variables 31 8.5 Pointers and Arrays 32 8.6 Dynamically Sized Arrays 33 8.7 The NULL Pointer and Pointer to void 34 8.8 Pointer Arithmetic 35 8.9 Strings 35 9 Files 38 9.1 File Pointers 38 9.2 Opening a File 38 9.3 Program Arguments 40 9.4 I/O Streams ‡ 41 9.5 Redirection of I/O Streams ‡ 41 10 Structures, Unions and Fields 42 10.1 Enumerated Types
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 85

l922 - Oxford University Computing Services Programming in...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online