• 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

Difference between a LinkedList and a Binary Search Tree BST

Printing Longest Common Subsequence

System Design: Designing a LLD for Hotel Booking

Advanced SQL Injection

Print all nodes that are at distance k from a leaf node

Implement LRU Cache

Find min element in Sorted Rotated Array (Without Duplicates)

Regular Expression Matching

Trapping Rain Water

Longest Increasing Subsequence

simple sql injection

Subset Sum Problem Dynamic programming

Reliance Jio Software Developer Interview Experience

Find the element that appears once others appears thrice

SAP Off Campus Hiring_ March 2015 Verbal Skills

Number of Islands BFS/DFS

Given a string, find the first character which is non-repetitive

Binary Tree Isomorphic to each other

Knight Tour Problem (Graph – Breadth First Search)

Stickler thief

Binary Tree in Java

C++ OOPs Part2

Connect n ropes with minimum cost

building with N steps, we can take 1,2,3 steps calculate number of ways to reach at top of building

Cisco Hiring Event 21st – 22nd Feb 2015

Rectangular chocolate bar Create at least one piece which consists of exactly nTiles tiles

Python List

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

Get Minimum element in O(1) from input numbers or Stack

CodeChef Code SGARDEN

Copyright © 2026 · Genesis Framework · WordPress · Log in