// A description about the program
//
// By ... (z0000000)
//
// Written on YYYY-MM-DD
//
#include <stdio.h>
#include <stdlib.h>
// Add your own #includes here
// Add your own #defines here
// Add your typedefs and structs here
// Add your function prototypes here
int main(int argc, char *argv[]) {
return EXIT_SUCCESS;
}
// Add your function implementations here
A simple program demonstrating the use of printf
Compile by typing
dcc -o helloWorld helloWorld.cor at home
gcc -Wall -Werror -O -o helloWorld helloWorld.c
Run by typing:
./helloWorld
#include <stdio.h>
int main(void) {
printf("Hello World!\n");
return 0;
}
A simple program with some common errors in it to demonstrate compiler error messages
Compile by typing
dcc -o errorExercise errorExercise.cor at home
gcc -Werror Wall -O -o errorExercise errorExercise.c
Run by typing:
./errorExercise
#include <stdio.h>
int mainn(void) {
printf("Hello World!\n");
prinf("Goodbye Everybody\n")
printf("asfhahfka2\n847hfaskhf;uhajkf");
}
Description: A demonstration of escape characters
#include <stdio.h>
int main(void) {
printf("This is a \"Hello World\" demo.\n");
return 0;
}
Description: A program to test your understanding of escape characters used in a lecture demonstration
See if you can work out what it would print and then compile it and run it to check
#include <stdio.h>
int main(void) {
printf("\\\\\n");
return 0;
}
#include <stdio.h>
int main(void) {
printf("H");
printf("e"); printf("llo");
printf(" W"); printf("o"); printf("r");
printf("ld!");
printf("\n"); return 0;
}
Printing a % character
Author : Angela Finlayson
Date:
This is a basic template for any C program you will write
#include <stdio.h>
int main(int argc, char * argv[]){
printf("I got 100%%\n");
return 0;
}