Skip to content

Instantly share code, notes, and snippets.

@46bit
Created September 5, 2012 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 46bit/3637638 to your computer and use it in GitHub Desktop.
Save 46bit/3637638 to your computer and use it in GitHub Desktop.
Super Simple C
#include <stdio.h>
// Welcome back to C
// Handy to ever explain simple C to a friend
int main (int argc, char const *argv[]) {
printf("%s\n", "Welcome to Count!");
printf("%s %s %s %s%s\n\n", "Printing from", argv[1], "for", argv[2], ".");
int count_from = atoi(argv[1]);
int count_for = atoi(argv[2]);
int count_max = count_from + count_for;
int counter;
for (counter = count_from; counter <= count_max; counter++) {
output_a_count(counter);
}
return 0;
}
int output_a_count (int counter) {
printf("%i\n", counter);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment