Removing an element from a char array (C) -
i'm trying remove char array , i'm having problems. read how numbers seems different removing chars it's not working me.
if i've following array:
char stuff[][20] = {"one", "two", "three", "four", "five"};
how can remove element "four" example, can get
{"one", "two", "three", "five"};
you dynamically allocating needed memory: array of char* memory strings.
then create array without item removed , copy data remains. free original array , strings.
it's bit complex not hard. may easier if create linked list - change application logic bit more.
Comments
Post a Comment