CPSC C Exam 1
Phases of C Programming
- Edit - Compile: - Preprocess - Assemble - Link - Load - Execute
Types of Instructions
- Programing Language Instructions: English like instructions written by programmers in high level languages - Instruction set Instructions: more primitive instructions that the programming language instructions are broken down into
Utilities
- System Maintence - Security - Efficiency - Data Recovery - User Experience
Basic Types:
-int -float -double -char -_Bool
Compile
2 steps: - preprocessor that automatically executes before translation phase begins - assembler which converts to assembly language code then object code.
How many bits are in a byte?
8
Systems software
A group of programs that coordinate and control the resources and operations of a computer system.
strcpy
Assigns value of string1 to "Hello" strcpy (string1, "Hello");
CPU
Central Processing Unit; the brain of the computer. Measured in GHz. Extracts data from memory and executes it
strcat
Concatenates string values. str (string1, string2);
Device Drivers
Connects operating system to hardware devices
Editing
Consists of Editing a file with an editor program
mkdir dir_name
Create directory dir_name
rmdir dir_name
Delete directory dir_name
Who invented C and when?
Dennis Richie in 1969-1973
UNIX
Developed by Ken Thompson and Dennis Ritchie in 1960s, then converted to C in 1973. Consists of: - a hierarchal file system - a command-line interface - multiple small utility programs - as well as the concept of computer processes and device files
Charles Babbage
He is known as the "Father of Computers." His ideas were later used to design calculators and computers.
Compiler
Made by Grace Murray-Hopper. Converts high level language into machine language.
Secondary Storage Devices
Media (e.g., jump drive, hard drive) capable of permanently storing data until it is replaced or deleted by the user. Measured in GB
Software Defn and Components
Programs that tell the computer what to do -Systems Software -Utilities -Applications
Applications
Programs that turn your computer into a powerful tool
RAM
Random Access Memory. For an instruction to be executed, it must be in RAM. Volatile. Measured in GB
strcmp
Returns 0 if str1 and str2 are equal, non-zero if they differ. strcmp (string1, string2);
What would "prog.c" be called?
Source Code
operating system
The main program that controls the operation of a computer
sematic error
These are logical errors, e.g. using a variable that hasn't been declared yet.
Alice Lovelace
This person from the 1800s is considered to have written the first "computer program". (From the 1800s? How can that be?) There is a computer programming language named after this person.
Language Translators
converts programming language to machine language
rm file_name
deletes file_name
Execute
executes program one instruction at a time
Linking
links object code to missing parts to create executional code
ls
lists content in current directory
Types of Programming Languages
machine language, assembly language, high-level language
What type of language is C?
procedural
int getchar()
reads one character at a time from a text string
mv src_file dest_file
renames src_file to dest_file
strlen
returns number of characters but does not include null strlen(string1);
ps
shows a list of processes you're running
cd ..
takes you back to previous directory
cd
takes you to home directory
Hardware Defn and Components
the physical devices that make up a computer system. -CPU -RAM -Secondary Storage Devices
Loader
transfers executable code into main memory
int putchar(int c)
writes one character at a time