I'm not sure what this error means but I know it has something to do with the way I'm passing the string into the function. I'm in my first programming class so forgive me if this is a n00b mistake..
Code:
//reverse
#include <stdio.h>
#include <string.h>
int reversed (char string1, char string2);
void swap (int* ptrA, int* ptrB);
int main(){
char word1[20], word2[20];
printf("first word");
scanf("%s", word1);
printf("second word");
scanf("%s", word2);
if (reversed(word1, word2))
printf("the strings are opposite");
else printf("the strings are not opposite");
system ("PAUSE");
return 0
}
//Pre: string1 is the name read in from the file. string 2 is the name from the
// customer_type array
//Post:If string1 is reversed and matches string2 1 is returned, if they don't
// match 0 is returned.
int reversed (char string1[], char string2[]) {
int i, len;
char temp;
len = strlen(string1);
for (i = 0; i < len/2; i++) {
swap (&string1[i], &string1[len-i-1]);
}
if (!strcmp(string1, string2);
return 1;
else
return 0;
}
//Pre: ptrA points to a single character in a string while ptrB points to the
// character equally distant from the center and on the other end of the
// string
//Post:Swaps the value contained in each of the memoory locations.
void swap (int* ptrA, int* ptrB) {
int temp = *ptrA;
*ptrA = *ptrB;
*ptrB = temp;
}