Erik Fredericks, frederer@gvsu.edu Fall 2025
Based on material provided by Erin Carrier, Austin Ferguson, and Katherine Bowers
Help develop a better understanding of what high (and low) level langauges are doing!
Understand memory management
System programming - interact with OS
Both are compiled, but to different things
pyc
Portability:
Java: more portable
C: less portable
Speed:
Compiled:
gcc program.c
javac program.java
Interpreted (run without compiling)
bash script.sh
python program.py
gawk program.awk
Hello world!
#include <stdio.h> int main(void) { printf("Hello world\n"); return 0; }
NOTE THE SEMI-COLONS!!!
Performs source code substitution!
# indicates a preprocessing directive
#
include - replaces a line with contents of file
include
define PI 3.14159
PI
gcc program_file.c
a.out
gcc -o myprogram program_file.c
myprogram
./a.out
./myprogram
gcc -o project.c project.c
Why?
(Including update/upgrade)
WSL (Ubuntu): sudo apt update && sudo apt upgrade && sudo apt install gcc
sudo apt update && sudo apt upgrade && sudo apt install gcc
sudo apt install build-essential
Potentially: Mac (Homebrew):
brew update
brew upgrade
brew info gcc
brew install gcc
brew cleanup
-o
-O
-Wall
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
O
-O1
-O2
-O3
-Os
-Oz
C++ is an object-oriented version of C
C is procedural
If you know C, you can do C++ (with extra effort)
Wikipedia says:
A successor to the program language B.
https://en.wikipedia.org/wiki/C_(programming_language)
The terminal is pretty easy but...
https://code.visualstudio.com/docs/languages/cpp
#define PI 3.1419 ... printf("PI: %f\n", PI);