I think your program should give the "segmentation fault error" as u
are trying to store higher capacity char array in lower......

On 6/18/07, Titi Anggono <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I want to create an array consisting strings, but I
> don't know where I made those mistakes.
>
> Here is part of code
> ==================
> .....
> char *arrayA[5];   /*name of array variable that
> stores strings*/
> char stations[10];
>
> i=0;
> while(fscanf(fileopen,"%s",&stations) != EOF){
>     arrayA[i] = stations;
>     printf("%s\n",arrrayA[i]);   //Print1
>     i++;
> }
>
> fclose(ffileopen);
>
> for(i = 0;i < 5;i++){
>    printf("%s\n",arrayA[i]);     //Print2
> }
> ==============================
>
> Print1 gives result what I want since it equals to
> scan the data. But Print2 gives me wrong result, the
> output is the last input of variable stations. For
> example,
> the output Print1 is
> LAT1
> LAT2
> LAT3
> LAT4
> LAT5
> but, the output of Print2 is
> LAT5
> LAT5
> ..
> ..
> LAT5
>
> Thanks for any explanations.
>
> Titi
>
>
>
> ____________________________________________________________________________________
> Sick sense of humor? Visit Yahoo! TV's
> Comedy with an Edge to see what's on, when.
> http://tv.yahoo.com/collections/222
>


-- 
Bharat Garg
Indian School of Mines
Dhanbad

Reply via email to