CS50 Week 1 Flashcards
What is the Linux command to show the content of a directory?
ls
Stands for list
The format of an if condition
if (x > y) { printf("x is less than y\n"); } else if (x > y) { printf("x is greater than y\n"); } else { printf("x is equal to y\n");
What is the Linux command to create a new folder?
mkdir
Make directory
What is the Linux command to change the directory?
cd
What is the Linux command to delete a file?
rm
What is the Linux command to delete a directory?
rmdir
What indicates a new line?
\n
What is the format of a while loop?
while ()
{
printf(“blah\n”)
}
What function will get a string?
GetString()
A line that starts with # is what?
A preprocessor directive
What is the symbol for the boolean operator “or”?
||
What is the symbol for the boolean operator “and”?
&&
What is the syntax for a switch?
switch (x) { case 1: // do this break;
case 2: // do that break;
default: // do this other thing break; }
What is the syntax of a for loop?
for (initializations; condition; updates) { // do this again and again }
What is the syntax for a while loop?
while (true) {
print(“hello, world\n”);
}