Created
June 16, 2014 11:55
-
-
Save mashcom/089da2231b677dc00ad8 to your computer and use it in GitHub Desktop.
basic forloop statement in c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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