1/10
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No study sessions yet.
6 Phases for program execution
edit - programmer creates a file in editor
precompress - inserts contents of other files and text replacements
compile - creates object code and stores it on disk
link - fills in functions referenced from libraries
load - program is loaded from disk to memory
execute - computer follows code
Errors
syntax - compiler can’t recognize code because it isn’t in the right language
runtime - occur as the program runs
fatal - program terminates without performing its job
nonfatal - program runs to completion producing incorrect results
comments
// COMMENT
/* COMMENT */
Code must-haves
# include <stdio.h>
int main(void) { }
printf (“ PRINTED TEXT \n “);
scanf (“%d”, &VARIABLE); (for integer)
printf ( “ COMMENT %d COMMENT ” , VARIABLE); (printing string with variable)
escape sequences
\n - newline
\t - tab over
\a - produces sound or visible alert
\\ - how to put a \ in a string
\” - how to put a “ in a string
initializing variables
int VARIABLE = VALUE
double VARIABLE = VALUE
variable names can have letters, digits, and underscores, and can’t start with numbers
operators
+ - addition
- - subtraction
* - multiplication
/ - division (integer division gives an integer result)
% - remainder (mod)
if statement
if (CONDITION) {
printf (“ %d COMMENT %d”, VARIABLE1, VARIABLE2); }
algorithm
a procedure for solving a problem with: actions in order
program control
the order in which statements should execute
pseudocode
an informal artificial language