Skip to content

Instantly share code, notes, and snippets.

@mashcom mashcom/forloop.c
Created Jun 16, 2014

Embed
What would you like to do?
basic forloop statement in c
# include <stdio.h>
int main(int argc, char * argv[]){
int i=0;
// go through each string in argv
// why am I skipping argv[0]?
for(i = 1; i < argc; i++) {
printf("arg %d: %s\n", i, argv[i]);
}
char *states[] ={"harare","byo","mutare","gweru","kwekwe"};
int states_count= 4;
for(i=0;i<=states_count;i++){
printf("the state is %s \n",states[i]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.