Code:
char *pointer[100];
...
pointer[i]=(char*)malloc((length+1)*sizeof(char));
Don't do that! It does not make any sense. You should use an array of structures to save the strings.
Code:
struct{
char *pointer;
}mystruct[100];
...
length=strlen(help);
mystruct[i].pointer = malloc((length)*sizeof(char));
...
for(k=0; k < length; k++)
{
mystruct[i].pointer[k] = help[k];
}
[edit]
Hmm .. I've just checked my suggested source code and found that it doesn't work for certain string sizes (strange output). Maybe you should use char arrays of fixed size in the structure. That should fix the problems.
Code:
struct{
char pointer[100];
}mystruct[100];
...
length=strlen(help);
...
for(k=0; k < length; k++)
{
mystruct[i].pointer[k] = help[k];
}
[/edit]
And better learn how to use fgets() instead of scanf(). It will save you lots of trouble. Never forget: fgets() does not remove the '\n' at the end of a line!
You should use a for loop:
Code:
for(x=0;x<100;x++)
{
printf("Input: ");
scanf("%s",help);
if(strcmp(help,"ENDE")==0)
{
break; //leave the for loop
}
length=strlen(help);
....
}