Ok, I know how the palindrome program works. I did it earlier this year, and now the teacher wants it using command line arguments.
I have been working on a project for a few days, and my brain is fried. Can anyone tell me what I have messed up here. If if give call it like "prog abba", it says the a's are not equal, but the b's are. Any ideas?
int main(int argc, char *argv)
int len, i, run,
match = 1;
if (argc > 1)
len = strlen(argv);
run = len/2;
for( i=0; i<run; i++ )
if ( argv[i] != argv[i][len-i-1] )
printf("%d: %c != %c\n", i, argv[i], argv[len-i-1]);
match = 0;
printf("%d: %c == %c\n", i, argv[i], argv[len-i-1]);
printf("%s is a palindrome!!!\n\n", argv);
printf("%s is not a palindrome.\n\n", argv);
Thanks for any help.