C String Programs
- C program to create and print array of strings
- C program to compare two strings using pointers
- C program to print indexes of a particular character in a string
- C program to capitalize first character of each word in a string
- C program to find the frequency of a character in a string
- C program to read a string and print the length of the each word
- C program to eliminate/remove all vowels from a string
- C program to eliminate/remove first character of each word from a string
- C program to read n strings and print each string\'s length
- C program to copy one string to another and count copied characters
- C program to remove all spaces from a given string
- C program to convert a string to sentence case
- C program to remove alphabets from an alphanumeric string
- C program to eliminate all vowels from a string
- C program to swap adjacent characters of a string
- C program to read time in string format and extract hours, minutes and second also check time validity
- Creating string buffer (character pointer), allocating memory at run time in C
- memcpy() function in C with Example
- Write your own memcpy() function in C
- memset() function in C with Example
- Write your own memset() function in C
- C program to compare strings using strcmp() function
- C program to check a string is palindrome or not without using library function
- C program to check a string is palindrome or not using recursion
- C program to print the biggest and smallest palindrome words in a string
- C program to print the smallest word in a string
- C program to print the biggest word in a string
- C program to reverse a string using recursion
- C program to reverse every word of the given string
- C program to remove a given word from the string
- C program to delete duplicate words in the string
- C program to sort strings in alphabetical order
- C program to find the frequency of the given word in a string
- C program to find the sum of all digits in the alphanumeric string
- C program to copy a string to another string using recursion
- C program to find the first capital letter in a string using recursion
- C program to find the first capital letter in a string without using recursion
- C program to find the frequency of every word in the given string
- C program to find the highest frequency of a character in the given string
- C program to print all possible subsets of a given length in string
- C program to check two strings are anagram or not
- C program to find a specific word ends with a specific character in the string
- C program to split the string using the strtok() function
- C program to split the string using strtok_r() function
- C program to demonstrate the strstr() function
- C program to implement own strstr() function
- C program to demonstrate the strpbrk() function
- C program to implement the strpbrk() user-defined function
- C program to sort the words of the string
- C program to implement the KMP pattern search algorithm
In this program, we will use strtok_r() function. This function is used to split the string and get words from a specified string based on a specified delimiter.
The strtok_r() works similar to the strtok() function. But strtok_r() is a re-entrant function.
Program:
The source code to split the string using the strtok_r() function is given below. The given program is compiled and executed using GCC compile on UBUNTU 18.04 OS successfully.
Output:
Explanation:
In the main() function, we created a string str initialized with "www.includehelp.com". Then we split the string based on dot (.) delimiter using strtok_r() function and printed the words on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer