CS50 Week 2 Flashcards
How many bits is an int?
32
How many bits is a long long
64
How many bits is a float?
32
How many bits is a double?
64
How many bits is a char?
8
Reminder: variables declared inside curly braces have scope limited to within the curly braces.
Reminder: variables declared inside curly braces have scope limited to within the curly braces.
How do you declare a global variable?
Declare it before main()
What is the function that gives a string’s length, and where is it found?
strlen(string)
string.h
How is a variable declared?
type name(parameter)
Type is the data type that will be returned
What is the type of a function that returns no value?
void
Where is a function declared?
The name should be declared above main()
The actual body of the function should be declared after main()
How many numbers can be represented by a 32 bit int?
2^32
roughly four billion
How do you cast numbers into a type while in an equation?
(float) 1
(float) #
Why can we convert between chars and ints?
Because chars are actually number values that correspond to symbols per ASCII
What is one thing that marks the limit of scope in C?
Curly braces.
Any variable declared inside a set of curly braces does not exist outside the curly braces.