c - Patial copy of string array -


Can I do something to copy string content from one copy to another?

  four ** word = (four **) molk (size of (four *) * line_form); Four ** child terms = (four **) maulok (size (four *) * len1); Int i; (I = startIndex; i & lt; endIndex; i ++) for [hair word [i] = word [i]; }    

Repeat the pointers on the lines of text, so that you You will eventually end up with two arrays, which point to the actual words in real physical memory.

With this problem, if you change the memory through the 'word' then 'hair word' because they will point to the same memory.

The safest way to do this is to get the string length of each 'word' and allocate new memory, copy the string so that 'childWords' points are scattered for different storage.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -