• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/34

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

34 Cards in this Set

  • Front
  • Back

scanf is the opposite of

pointf

softly typed def

variables are just bytes

scanf can result in

buffer overruns

2 differences between c and java

There is little error checking in C, in architecture in C is hardware dependent

In C, everything is an ______

object

if int *xPtr defines a pointer, xPtr =

&x

in _______ , a %__ consumes the string

sscanf, s

strtok returns: (2 things)

a pointer to the next token or NULL if done

3 lines to read a file:

FILE *f;


f = fopen("filename.txt", "r")


fgets(str, size, f);

3 modes to open a file

r for reading


w for writing


a for appending

DBC explanation

when we design a class and its interface (public routines), we are implicitly defining a contract "This is what we will provide you"

DBC def

a contract guarantees that we will always leave an object in a valid state

what do we use for defensive programming

pre and post conditions

invariant def

an invariant is a property that makes the state of an object well-defined

the C preprocessor is useful for:

- include library defs


- constants and macros


- conditional compilation

structs cannot hold

routines

struct architecture:

struct NAME


{


int


};

2 types of storage

stack, heap

stack purpose

allocate local vars for routines

heap purpose

area of memory for putting objects


persists beyond function calls (unlike runtime stack)

program's memory structure:

heap (expands down)


empty space


RTS(expands up)


Data


Text

to create objects we use: (3 things)

1. sizeof(typename)


2. malloc(size)


3. free(ptr)

if we pass an array to sizeof(), what will the size be?

4, the size of a pointer

malloc(size) returns:

a pointer to the allocated object on the heap

memory leak example:

a=malloc(sizeof(int));


a = NULL;

scaffolding def

the code we write to automate tests; generate our data patterns. Scaffolding simulates the system our code interacts with

edge cases, aka

boundary conditions, special cases

edge cases def

places code can usually go wrong

edge cases for sorting: (5 items)

- list of length 0


- list of length 1


- n sorted #s


- n reverse sorted #s


- n identical #s

big bang testing def

all modules are brought in together simultaneously

to be a computer scientist you need: (3 things)

- to understand the vocab


- see the state


- to be able to follow the flow

how do we know that the scaffolding is correct?

must attempt to test all possible solutions that the module should be able to deal with

Test driven development def

we should write the tests before the code

switch/case block

switch (variable){


case [variable value]: