2 + 3. Anatomy of a program Flashcards
when we run a program we are running
a) an object file
b) a machine language file
-computers understand machine language, and object files are in machine language
object file
file containing object code
use of xcode
to type in + edit your program files
terminal utility
gives UNIX interface, used to enter UNIX commands to iMac
terminal commands
cd: change directory
ls: show programs in folder
make: compiles program
when compiling program
don’t type .cpp, just write the file name
troubleshooting: ‘program’ is up to date
probably forgot to save edited program
troubleshooting: no rule to make target ‘program’
mistyped filename or file not in current directory
troubleshooting: use of undeclared identifier
syntax error, didnt declare a variable
Use of // or /* */
a comment (ignored)
include
allows program to use built-in facilities for input and output (IO)
int main () {}
a function that returns an integer (int), function is called main
return 0
main returns the integer 0
{ }
used to define functions/processes
variables
places which store values