• 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

Level order traversal in Spiral form

Trie Dictionary

Convert number to words java

C++ OOPs Part1

simple sql injection

Search element in a matrix with all rows and columns in sorted order

Adobe Interview Questions 8 month Exp

Leetcode: Merge Intervals

Find the smallest window in a string containing all characters of another string

Maximum difference between two elements s.t larger element appears after the smaller number

HackeEarth Flipkart’s Drone

Microsoft BING Interview Experience

CodeChef’ RRCOPY

Number of Islands BFS/DFS

Test Cases for Round Function

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

BFS (Breath First Search)

Amazon Interview On-Campus For Internship – 1

K’th Largest Element in BST when modification to BST is not allowed

System Design: Designing a LLD for Hotel Booking

Longest Increasing Subsequence

Given Set of words or A String find whether chain is possible from these words or not

CodeChef Code SGARDEN

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

Find if a binary tree is height balanced ?

Code Chef PRGIFT Solution

flattens 2 D linked list to a single sorted link list

Python Dictionaries

Find Percentage of Words matching in Two Strings

Calculate price of parking from parking start end time prices

Copyright © 2026 · Genesis Framework · WordPress · Log in