Section One - C Primer Flashcards

2
Q

Daemons

A

Program with no GUI and run in the background.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

command line tools

A

Programs that run for a short time in terminal.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Function

A

A list of instructions for computer to execute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Variable

A

Place where data is stored.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

short, int, long

A

These three types are whole numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

float, double

A

Floating point number – a number that can have a decimal point.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

char

A

One byte integer that we usally treat as a character.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

pointers

A

A Pointer holds a memory address. Declared using a asterisk.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

struct

A

A struct is a type made up of other types.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

if/else

A
if (conditional) {
        // execute this code if the conditional evaluates to true 
 } else {
        // execute this code if the conditional evaluates to false }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

“==”

A

Are they equal?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

“!=”

A

Are they not equal?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

&&

A

Logical AND – true if and only if both are true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

||

A

Logical OR – false if and only if both are true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

!

A

Logical NOT – true becomes false, false becomes true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

boolean variable

A

A variable that can be true or false. BOOL someVarName =

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

else if

A
if (truckWeight <= 0) {
        printf("A floating truck\n"); 
} else if (truckWeight < 40000.0) { 
        printf("A light truck\n"); 
} else { 
        printf("A heavy truck\n"); 
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

conditional (ternary) operator

A

int minutesPerPound = isBoneless ? 15 : 20;

20
Q

function frame

A

Think of frame as a blackboard that you scribble on while function is running.

21
Q

stack

A

is a place in the computer memory where all the variables that are declared and initialized before runtime are stored.
Automatic values – variables are automatically destroyed when function ends.

22
Q

heap

A

is the section of computer memory where all the variables created or initialized at runtime are stored.

23
Q

three memory segments

A

text (code) segment
stack segment
heap segment

24
Q

recursion

A

a function that calls itself.

25
Q

static variable

A

A variable with static storage duration has a permanent storage location. It retains its value throughout the execution of the program. Only accessible from the code in the file it was declared.

26
Q

global variable

A

These variables can be accessed (ie known) by any function comprising the program.

27
Q

printf()

A

a function that accepts a string argument. can take literal string called Format string by surrounding text in double quotes.

28
Q

printf() tokens

A
token values inside string are replaced with values by variables at end of string.
%i or %d        int
%c		       char
%f		       float
%lf	 	       double
%s		       string
%lo                octal
%lx                hexadecimal
%e                scientific notation
%p                pointer
29
Q

modulus operator %

A

Like / but returns the remainder instead of the quotient.

30
Q

cast operator

A

is the type you want placed in parentheses to the left of the variable you want converted. example: converts int into a float (float)3

31
Q

increment operator

A

x++

32
Q

decrement operator

A

x–

33
Q

increment operator shorthand

A

x += 5; // x = 10

-=, *=, /=, and %=

34
Q

integer

A

a number without a decimal point. A whole number.

35
Q

NSInteger, NSIUinteger

A

Apple created to integer types that are 32-bit on 32-bit platforms and 64-bit on 64-bit platforms. They are the same as long and unsigned long.

38
Q

break loop

A

sometimes its nesecary to break out of a loop. break;

39
Q

continue loop

A

someimes its nesecary to forget this and start next run. example: if (i % 3 == 0) {
continue;
}

40
Q

dereferencing the pointer

A

reading data at the address of the pointer.

41
Q

sizeof()

A

Allows a program to determine how much memory is required by a particular type
sizeof(int)

42
Q

modf()

A

modf takes a double and saves both the integer and the fraction. It returns the fractional part and saves the int to an address.
fractionPart = modf(pi, &integerPart);

43
Q

pass-by-reference

A

you supply an address and you put a number there.

44
Q

malloc()

A

You claim buffer memory using malloc() from the region of memory known as the heap. When done using the buffer you use function free()
float *startOfBuffer;
startOfBuffer = malloc(1000 * sizeof(float));

45
Q

while loop

A
int i = 0; 
while (i < 12) { 
printf("%d. Aaron is Cool\n", i);
 i++; 
}
46
Q

for loop

A

for (int i = 0; i < 12; i++) {
printf(“%d. Aaron is Cool\n”, i);
}