1/8
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
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”, )
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”)
what are symbolic constants and how do you declare them?
// format:
#define varname value
// exs:
#define MINUTE 60
#define DEFAULT falsec = 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.
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.
prefix vs postfix increment differences, e.g. consider the difference between the two:
int x = n++
// vs
int x = ++n
// given n = 5int x = n++ // x becomes 5, then n incremented to 6.
int x = ++n // n increments to 6, then x becomes 6.ternary operator format?
expr1 ? expr2 : expr3where 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
two things about static vars
they exist only in the file they’re in
once declared in a file, they stay in memory and don’t disappear even if made inside functions