Programming in 'C' : How to clear the char array for the next string : <p>I try to write a code that can read a text file in a specific order.
The Problem is that the strings overwrite the last string in the Array, but I want that the array is cleared for the next string, however I don't know how to do this.</p>

<p>Here is the text file:</p>

<pre><code>@str_hello_world_test={hello world!test}
@str_hello_world={hello world}
</code></pre>

<p>And the output is here:</p>

<pre><code>symbol:str_hello_world_test²`
string:hello world!testtest²`

hello world!testtest²`
symbol:str_hello_worldttest²`
string:hello worldorldttest²`

hello worldorldttest²`
</code></pre>

<p>And my Code:</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

#define MAXBUF 255

//prototypes
void readingFile(FILE* fp);
char* readingSymbol(FILE* fp);
char* readingString(FILE* fp);

int main(void)
{
    FILE* fp;
    char directory[MAXBUF];

    puts("Geben sie ein Verzeichnis ein: ");
    gets(directory);
    fp = fopen(directory, "r");

    readingFile(fp);

    system("pause");
    return EXIT_SUCCESS;

}

void readingFile(FILE* fp){
    int c;

    while((c = fgetc(fp)) != EOF){
        char* symbol = readingSymbol(fp);
        char* string = readingString(fp);
        printf("%s\n", symbol);
    }
    return;
}

char* readingSymbol(FILE* fp){
    int c;
    int i = 0;
    char symbol[MAXBUF];

    while((c = fgetc(fp)) != '='){
        if(c == '@'){
            continue;
        }
        else{
            symbol[i] = (char)c;
            i++;
        }
    }
    printf("symbol:%s\n", symbol);
    return symbol;
}

char* readingString(FILE* fp){
    int c;
    int i = 0;
    char str[MAXBUF];

    while((c = fgetc(fp)) != '}'){
        if(c == '='){
            continue;
        }
        else if(c == '{'){
            continue;
        }
        else{
            str[i] = (char)c;
            i++;
        }
    }
    printf("string:%s\n\n", str);
    return str;
}
</code></pre>
