Hey guys
My code needs to save a list of names from a file and sort out the ones who are appearing several times. A pointer array should be used for the strings.
I already wrote a code but it doen't works. It crashes when I try to start is.
Heres my code:
Code:
#include <stdio.h>#include <stdlib.h>
#include <string.h>
int main()
{
char *namen[500];
char InputBuffer[255];
int x=0, i, j, anzahl=0;
FILE* pDatei;
pDatei=fopen("Vornamen.txt","r");
while(fscanf(pDatei,"%s",InputBuffer)!=EOF)
{
for(i=0;i<=x; i++)
{
if(namen[i]==InputBuffer)
{
break;
}
else if(i==x)
{
namen[x]=InputBuffer;
x=x+1;
}
}
}
fclose(pDatei);
}
So can you find an error, cause for me it should work.
I'm programming with code::bloxx btw.
Thankfull for very Hint