cs288 C prelim

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/8

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:55 PM on 10/7/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

9 Terms

1
New cards

what are the args for the printf statement?

first arg is character string to be printed. if we put % in there, then for each one we can add additional arguments denoting what to substitute there.

ex: printf(“%d C, %d F”, )

2
New cards

how to specify decimal places of variable substitution into printf?

%[totalnumchars].[precision]f where totalnumchars is optional.

ex usage: printf(“value of x is %.2f”)

3
New cards

what are symbolic constants and how do you declare them?

// format:
#define varname value
// exs:
#define MINUTE 60
#define DEFAULT false


4
New cards

c = getchar() != EOF vs (c = getchar()) != EOF in C

in the former, you’re assigning c the value of 1. in the latter, we actually assign c a letter and then compare C to EOF.

5
New cards

what is the format of character strings (they’re made of?)

arrays, and the last item is always \0 which is the null character. there may be a \n before it, but last one is always null char.

6
New cards

prefix vs postfix increment differences, e.g. consider the difference between the two:

int x = n++
// vs
int x = ++n
// given n = 5


int x = n++ //  x becomes 5, then n incremented to 6.
int x = ++n // n increments to 6, then x becomes 6.


7
New cards

ternary operator format?

expr1 ? expr2 : expr3

where expr1 is the condition we’re testing, expr2 is the value used if the condition is true, expr3 is the value used if the condition is false

8
New cards

two things about static vars

  1. they exist only in the file they’re in

  2. once declared in a file, they stay in memory and don’t disappear even if made inside functions


9
New cards