About 6,880,000 results
Open links in new tab
  1. Deleting string from array of strings (C) - Stack Overflow

    Nov 25, 2013 · Given a pointer to an array of char* pointers terminated with an empty string (or NULL), delete all strings in the pointer array that contain word. The resulting potentially compacted array is the return value of the function.

  2. Array of Strings in C - GeeksforGeeks

    Jan 10, 2025 · In C, an array of strings is a 2D array where each row contains a sequence of characters terminated by a ‘\0’ NULL character (strings). It is used to store multiple strings in a single array. Let’s take a look at an example:

  3. How to delete a string from an array of string in c

    Jul 21, 2022 · Use strcpy() to copy strings. Or change it to an array of pointers, and allocate the strings dynamically. Although arrays are implemented with pointers in C, the compiler will treat them the differently. As you can see in your own example the line n [i] = n [i+1] causes the error you see, because n [i] is an array of chars.

  4. Deletion of character in String - GeeksforGeeks

    Apr 23, 2024 · Given a string str and an integer position pos, the task is to delete the character at the specified position pos from the string str. Examples: Traverse the string and push all the characters to another string or character array except the character which needs to be deleted.

  5. How to clear a char* string array in C - Ubuntu Forums

    Apr 15, 2010 · A couple of ways come to mind. Given that strings in C are usually terminated by an ASCII zero, the easiest would be to set the first byte to zero. Another way might be to use memset() to set the whole string to zeros.

  6. Remove all occurrences of a character in a string

    Oct 17, 2024 · Given a string and a character, remove all the occurrences of the character in the string. Examples: The idea is to maintain an index of the resultant string. Time Complexity : O (n) where n is length of input string.

  7. Guided: Arrays, Strings, and Basic String Manipulation in C

    Feb 11, 2025 · In this lab, you will learn how to manipulate arrays and strings in C by implementing operations such as adding, searching, deleting, and listing contacts in a simple contact management app. You will also practice debugging common array and string issues, sorting, and searching data effectively.

  8. How to delete a string in an array in C - Stack Overflow

    Nov 20, 2020 · For example, to delete a string from an array of strings means to delete all character content from that area of memory. i.e. either setting the first character of the string to NULL , or memset() the entire array element to NULL , eg: memset(array, 0, sizeof array); .

  9. Completely deleting a string array element - DaniWeb

    Aug 23, 2009 · If you have an array of four strings: mystring[0] = "x"; mystring[1] = "xx"; mystring[2] = "xx"; mystring[3] = "xxx"; You can "delete" elements 1 and 2 by overwriting them and moving element 3 up to element 1:

  10. arrays - Remove characters from a string in C - Stack Overflow

    If you need to work extensively on strings you'll probably need to know about pointers and pointer arithmetic, but otherwise here are some library functions that will undoubtedly help you: strchr() to find a character (say, '&') in a string. strcmp() and strncmp() to compare two strings.

  11. Some results have been removed
Refresh