Note that there are some explanatory texts on larger screens.

plurals
  1. POarray of pointer pointing to arrays of strings
    primarykey
    data
    text
    <p>i created a code which transfers sentences from a file into arrays according to lines. for example:</p> <pre><code>char ** Sentences[2] Sentences[0]="hello ola hiya howdy" Sentences[1]="chips fries" </code></pre> <p>i need to seperate each line into it's words(i already have a ready function which does that,and stores the output into a <code>char **</code> array. i would like to store all arrays of words(in this case - 2,1 for each sentence) by creating an array of pointers to those arrays. i will be more than glad to know how it's done.i also need to create a temporary array using malloc and stor the words in it,in order to dynamically create the arrays each time.</p> <p>apposingly,can i use a char <em>*</em> array and store the arrays created inside of it?</p> <p>i will be more than glad for a solution.</p> <p>Edit: i created a memory allocating array,yet it keeps overriding itself:</p> <pre><code>char ** Temp=NULL; char **pointer[ir]; for (Note = 0; Note &lt; ir; ++Note) { Temp=malloc(Count(' ',Sentences[Note])*sizeof(char *)); int ifd=StoreArr(Sentences[Note],Temp," "); pointer[Note]=&amp;Temp; printer(*(pointer[Note]),ifd); } </code></pre> <p>the output i get is this:</p> <p>hello ola hiya howdy eitan eitanon eitanya</p> <p>but if i call </p> <pre><code>printer(*(pointer[0]),3); </code></pre> <p>outside of the for,i get</p> <pre><code> eitan eitanon eitanya </code></pre> <p>instead of the first words(which means the Temp does not allocate memory)? i will be more than glad for assistance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload