mercredi 12 janvier 2022

Error C: subscripted value is neither array nor pointer nor vector

I'm new at programming in C language and I'm trying to do a program which adds ellipsis in every space I have in a table, which contains some text. I don't know why I get that error I told you on the title and it's imposible for me to find the problem.

Before the code I only have set this:

char string1, string2;
int ellipsis(string1, string2)
{
    int m, n, tan, blanks;
    tan=strlen(string1);
    blanks = 0;
    n=0;
    for(m=0; m<tan; m++)
        if (string1[m] != ' ')   //<-----The program says that the error is in this line.
        {
          string2[n] = string1[m];
          n++;
        }
        else
        {
            blanks++;
            string2[n] = '.';
            string2[n+1] = '.';
            string2[n+2] = '.';
            n+=2;
        }
    string2[n] = '\0';
    return blanks
}



Aucun commentaire:

Enregistrer un commentaire