C Flashcards
What is an int and how many bytes does it have
An int is a integer data type used for variables, and it has 4 bytes
What is an unsigned int and how does it relate to regular int?
It is a qualifier that doubles the positive values available for int data types and removes the negative values.
What is a char and how many bytes does it include?
Char is a character data type that includes up to 8 bits or 1 byte and stores a single character
What is ASKI and how does it relate to char?
ASKI is a that tells what number related to what character
What is a float and how many bytes does it take up?
A float is a decimal or floating data types in variables. Additionally, they take up 8 bytes or 64 bits. These are considered real numbers and allow for more precise numbers.
What is void?
Void is a type rather than a data type and can be used as a place holder. If used as a return value, it does not return anything. Void can also be used as a function argument.
What is bool?
include<cs50.h> to include bool type variables in C.</cs50.h>
A boolean value data type that can hold either true or false.
What is string
include <cs50.h> to utilize string types in C</cs50.h>
String is a text data type that includes characters.
What are structs and typedefs?
They allow you to create your own data types and will be discussed later in the course.
How do you define a variable?
Nude the data type and the variable name, ending in a semi-colon.
Can you define multiple variables on the same line, and if so, how?
Yes, integers of the same type can be defined on the same line with their names separated by commas.
What is one good design tip for defining variables?
Oy define them when you need them.
How do you use variables in your code?
Include the variable name, the assign operator, and the value, followed by a semi-colon.
What is the assign operator?
The equal sign
What are the arithmetic operators in C?
+, -, *, and /
Additionally, the modulus operator is %