|
CS456 - Systems Programming
Spring 2026
|
Displaying ./code/ch1/hello_world.c
// hello_world.c
// this prints "hello world" to the screen
// compile by running gcc -o hello_world hello_world.c
// from Ch 1, pg 2 in text
#include <stdio.h> //tells the preprocessor to read contents of header file
//this is what lets us use the printf function
// main function below
// note that the return type here is void (and not int like we'd usually do)
// a return type of void indiates a function that does not return a value
// will still compile and work, but will throw a warning
// compiler doesn't like main returning anything other than an int
// add -Wall when compiling to see warnings, as they may not be set to come up by default
void main(){
printf("hello, world\n"); //this is what prints the text to the screen
}
|