Well I did that, and I am sure it is not what you expected me to do knowing that it doesn't work...
Code:
#include <stdio.h>
#include <string.h>
int main (int argc, char*argv[]){
int i;
int lenth;
char argx[100];
int nbarg;
for (i=1;i<argc;i++){
strcpy(argx, argv[i]);
lenth = strlen(argv[i]);
if (argx[lenth]=="c"&& argx[(lenth-1)]== ".") {
printf("%s ",argv[i]);
}
}
printf("\n");
return 0;
}
Code:
questionB1.c: In function ‘main’:
questionB1.c:12:18: warning: comparison between pointer and integer [enabled by default]
questionB1.c:12:41: warning: comparison between pointer and integer [enabled by default]
well maybe itwill sound really nooby but seeing that i tryed strcmp(argx[lenth],"c")==0 but it is even worse...
I use strcpy because i didn't want to to argv[i][lenth] which would have been a 2 dimentions table...