• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to secondary sidebar

GoHired

Interview Questions asked in Google, Microsoft, Amazon

Join WeekEnd Online Batch from 4-April-2020 on How to Crack Coding Interview in Just 10 Weeks : Fees just 20,000 INR

  • Home
  • Best Java Books
  • Algorithm
  • Internship
  • Certificates
  • About Us
  • Contact Us
  • Privacy Policy
  • Array
  • Stack
  • Queue
  • LinkedList
  • DP
  • Strings
  • Tree
  • Mathametical
  • Puzzles
  • Graph

strtok()

March 21, 2014 by Dhaval Dave

Function Strtok

char * strtok ( char * str, const char * delimiters );
What it does : Split string into tokens
A sequence of calls to this function split str into tokens,
which are sequences of contiguous characters separated by any of
the characters that are part of delimiters

Example

/* strtok example */


int main ()
{
  char str[] ="This-is Go,Hired Site.";
  char * pch;
  printf ("Splitting string "%s" into tokens:n",str);
  printf ("--------");
  pch = strtok (str," ,.-"); // ',' '.' and '-' will be removed
  while (pch != NULL)
  {
    printf ("%sn",pch);
    pch = strtok (NULL, " ,.-");
  }
  return 0;
}
Output:
Splitting string “This-is Go,Hired Site.” into tokens:
——–
This is Go Hired Site

Similar Articles

Filed Under: problem Tagged With: Array, string

Reader Interactions

Primary Sidebar

Join WeekEnd Online/Offline Batch from 4-April-2020 on How to Crack Coding Interview in Just 10 Weeks : Fees just 20,000 INR

Join WeekEnd Online/Offline Batch from 4-April-2020

WhatsApp us

Secondary Sidebar

Custom Search

  • How I cracked AMAZON
  • LeetCode
  • Adobe
  • Amazon
  • Facebook
  • Microsoft
  • Hacker Earth
  • CSE Interview

Top Rated Questions

Printing Longest Common Subsequence

Check Binary Tree is Binary Search Tree or not

Flipkart SDET Interview Experience

Python String and numbers

Leetcode: Edit Distance

Urban Ladder Written Test.

Walmart Labs Interview Experience

LeetCode : Word Search

Flipkart Set 1 On Campus with Answers

Convert number to words java

Generate largest number arranging a no. of given non negative integer numbers

Sort an array according to the order defined by another array

Handle duplicates in Binary Search Tree

FizzBuzz Solution C C++

Calculate price of parking from parking start end time prices

Linked List V/S Binary Search Tree

Binary Tree Isomorphic to each other

Serialise Deserialise N-ary Tree

Find min element in Sorted Rotated Array (With Duplicates)

Difference between a LinkedList and a Binary Search Tree BST

Binary Tree in Java

Hackerearth : Counting Subarrays

Maximum path sum between two leaves

Length of the longest substring without repeating characters

Client Server C program

Get K Max and Delete K Max in stream of incoming integers

Reliance Jio Software Developer Interview Experience

Python Dictionaries

There are N nuts and N bolts, u have to find all the pairs of nuts and bolts in minimum no. of iteration

N teams are participating. each team plays twice with all other teams. Some of them will go to the semi final. Find Minimum and Maximum number of matches that a team has to win to qualify for finals ?

Copyright © 2023 · Genesis Framework · WordPress · Log in