- Information
- AI Chat
Was this document helpful?
APSC 160 Notes
Course: Introduction To Computation In Engineering Design (APSC 160)
71 Documents
Students shared 71 documents in this course
University: The University of British Columbia
Was this document helpful?
APSC 160 Notes
Fundamentals I
●Comment Statement:
○Included for the benefit of other programmers + ignored by compiler when the
program is translated to machine language.
○Provides information about who wrote it, when it was written and what
program does when its run
●Compiler Directive:
○Instruction for the compiler rather than an instruction to be executed when the
program runs
○All compiler directives in C start with “#” character
●Header File:
○Contains declaration of symbols used by our programs
○Ex. Stdio.h
■Includes declaration of “printf” function that is used by our program to
print message on screen
●Function: “return 0;”
○Terminates program, indicates program terminated normally
Fundamentals II
●Abstraction: process of hiding non-essential details and only exposing those aspects
of a system we are interested in
●Header File “#define”
○Used to create symbolic constant. When compiler executes directive, it
searches for all instances for symbol listed beside this header file and replaces
it with value beside symbol
■Symbolic constant: makes programs easier to read and maintain.
Should be used to represent constant values. Capitalized
Fundamentals III
●Have to end every line with “;”
●Variable declaration: two parts, type of data to be stored in variable and name of
variable (data type, variable name)
○Type of data depends on what variable is being represented for
○Variable name is chosen by programmer
○Variables must be declared before they are used in program