12
Review C Language Features – control flow – C operators – program structure – data types – I/O and files Problem Solving Abilities

Review C Language Features –control flow –C operators –program structure –data types –I/O and files Problem Solving Abilities

Embed Size (px)

Citation preview

Page 1: Review C Language Features –control flow –C operators –program structure –data types –I/O and files Problem Solving Abilities

Review

• C Language Features

– control flow

– C operators

– program structure

– data types

– I/O and files

• Problem Solving Abilities

Page 2: Review C Language Features –control flow –C operators –program structure –data types –I/O and files Problem Solving Abilities

Control flow

• Looping with while, for,

do-while

• conditional execution with

if, if-else, switch

• jumps with break,

continue, goto

Page 3: Review C Language Features –control flow –C operators –program structure –data types –I/O and files Problem Solving Abilities

Control flow

for(j = 0, j < 10; ++j) { . . . }

if ( x < 0 ) { . . . } else { . . .}

Page 4: Review C Language Features –control flow –C operators –program structure –data types –I/O and files Problem Solving Abilities

C Operators

• Meaning of the various

operators and their

precedence and association.

• What are ++, --, &&,

||, !, ~, &, ^, |, =,

==, !=, <, >, >>, <<,

+=, &=, *, ->, ., ? :,

sizeof, etc

Page 5: Review C Language Features –control flow –C operators –program structure –data types –I/O and files Problem Solving Abilities

Program Structure

• main() and function, function

prototype declaration,

function definition, argument

passing, call by value vs call

by reference.

• Auto, extern, static storage

classes

• Use of standard library

functions, especially I/O

functions.

Page 6: Review C Language Features –control flow –C operators –program structure –data types –I/O and files Problem Solving Abilities

Program Structure

#include <stdio.h>

int g = 0;

char f(int x);

main()

{

char c;

c = f(5);

. . .

}

char f(int x)

{

. . .

}

Page 7: Review C Language Features –control flow –C operators –program structure –data types –I/O and files Problem Solving Abilities

Data Types

• Simple data types - int,

char, float, double

• Array, pointer, equivalence

between array syntax and

pointer syntax

• User defined types -

structure, typedef

Page 8: Review C Language Features –control flow –C operators –program structure –data types –I/O and files Problem Solving Abilities

Data Types

main()

{

int x, y, *p;

char s[100];

struct str {

float u;

float v;

int *pt;

} a, b, c;

. . .

}

Page 9: Review C Language Features –control flow –C operators –program structure –data types –I/O and files Problem Solving Abilities

Others

• Macros, #define, #if, etc

• Open and close files

• Dynamic memory allocation, malloc(), calloc()

• Internal representations of integers

• Type casts

Page 10: Review C Language Features –control flow –C operators –program structure –data types –I/O and files Problem Solving Abilities

Problem Solving

• The ability of solving a

problem by computation

through a computer program

(efficiently)

Page 11: Review C Language Features –control flow –C operators –program structure –data types –I/O and files Problem Solving Abilities

Final Exam

• Last for 2 hours

• 5 to 6 problems with varied weights

• Problems similar to tutorials and labs

• Requirement of memorization is minimal

• Overall weights, midterm and quizzes 20%, labs 20%, final 60%

Page 12: Review C Language Features –control flow –C operators –program structure –data types –I/O and files Problem Solving Abilities

Consultation During Review Period

• Feel free to ask A/Prof Wang Jian-Sheng or Mdm Alice Heng questions on C.

• A/Prof Wang's office: S17, Level 7, room 07-21. Tel 874 6880.

• Consult our CZ1102 web pages (transparencies) if you have never been there: http://www.cz3.nus.edu.sg/