I'm trying to pass back an updated char array to the original main() function, however when i try to copy over the array with a pointer before it it gives me "Char " differs in levels of indirection from char() [15]'
This is a ISBN validator program.
Here it is:
int main(void)
{
    int divisible;
    char choice, trash;
    char code[15];
    do
    {
        printf("Enter an ISBN (book) number:\n");
        fgets(code, 15, stdin);
        printf("The ISBN entered is:%s\n", code);
        divisible = testISBN(&code);
        if (divisible == 1)
            printf("\n\n\tValid ISBN Number\n");
        else
            printf("\n\n\tInvalid ISBN Number\n");
        printf("\nDo you wish to continue? (Y/N)\n");
        choice = getchar();
        trash = getchar();
    } while (toupper(choice) != 'N');
    return 0;
}
int testISBN(char *code)
{
    int i;
    int sum = 0;
    int weight = 10;
    char codefinal[10];
    int x = 0;
    for (i = 0; i<15; i++)
    {
        int chVal;
        if ((i == 9) && (toupper(code[i]) == 'X'))
        {
            printf("%c",code[i]);
            chVal = 10;
        }
        else
        {
            chVal = code[i] - '0';
        }
        if (chVal == 0 || chVal == 1 || chVal == 2 || chVal == 3 || chVal == 4 || chVal == 5 || chVal == 6 || chVal == 7 || chVal == 8 || chVal == 9) {
            char y = (char)chVal;
            codefinal[x] = y;
            x++;
        }
        sum += chVal * weight;
        weight--;
    }
    printf("sum is %d", sum);
    for  (i = 0; i < 15; i++) {
        *code[i] = codefinal[i];
        printf("%c", code);
    }
    return (sum % 11) == 0;
}
At the very bottom where i said *code[i] = codefinal[i] is where i get the issue. I'm just trying to pass back by pointer my new updated array of numbers to my main.
 
     
     
    