About 1,470,000 results
Open links in new tab
  1. c - Finding a substring, using pointers - Stack Overflow

    Dec 12, 2018 · As the title mention, I want to check if a substring is found or not into another string. The idea is to compare the first character of the text variable with the pattern variable, …

  2. String find() in C++ - GeeksforGeeks

    Apr 25, 2025 · In C++, string find () is a built-in library function used to find the first occurrence of a substring in the given string. Let’s take a look at a simple example that shows the how to use …

  3. How to Find a Substring in a String in C - Examples - Tutorial Kart

    In C, you can find a substring within a string using various methods, including standard library functions like strstr() and strchr(), as well as custom implementations. These functions help …

  4. Extract substring from a string using pointers - Coursecrux

    Apr 13, 2020 · To extract the substring, first we have to traverse the string 'str1', and take the pointer 'ptr1' to the position 'pos'. for(i=0;i<pos;i++) {ptr1++;} Now, starting from position 'pos', …

  5. C find substring in a string with pointers - Stack Overflow

    Apr 13, 2015 · char *find_substr(char *string, char *substr) { for (;;) { if (*string == *substr) { for (char *p1 = string, *p2 = substring;;) { if (!*p2) return string; if (*p1++ != *p2++) break; } } if …

  6. C substring, substring in C - Programming Simplified

    C substring program using pointers. To find substring we create a substring function which returns a pointer to string. String address, required length of substring and position from where to …

  7. How to Get Substring in C - Delft Stack

    Mar 11, 2025 · Another elegant way to extract a substring in C is through pointer arithmetic. This method can be particularly efficient, as it allows you to manipulate the string directly without …

  8. C Program to Fetch a Substring From a String

    Here we are using a user-defined function getSubString, which takes source string pointer, destination string pointer, starting index and substring length(num) as input arguments and …

  9. Get a Substring in C - GeeksforGeeks

    Dec 6, 2024 · Iterate the string from the given position using a loop and copy the specified number of characters from this position to the substring. char s[] = "Hello, Geeks!"; The above …

  10. C Strings with Arrays and Pointers

    Feb 27, 2025 · For this activity you will implement three versions of a basic find function to find information in a string; in two of the three cases you will implement both an array version with …

  11. Some results have been removed
Refresh