• 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

Sort Stack in place

Check Binary Tree is Binary Search Tree or not

Check if an array has duplicate numbers in O(n) time and O(1) space

Advanced SQL Injection

Doubly linked list

TicTacToe Game As Asked in Flipkart

SAP Hiring Off-Campus General Aptitude

VMWare SDEII Interview

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

25 horses 5 tracks Find 3 fastest puzzle

Inorder and Preorder traversals of a Binary Tree given. Output the Postorder traversal of it.

Print vertical sum of all the axis in the given binary tree

Binary Tree Isomorphic to each other

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

‘N’ Story Building, with 1,2,3 steps how many ways can a person reach top of building.

Python Array String

Fibonacci Hashing & Fastest Hashtable

Calculate price of parking from parking start end time prices

Adobe Interview Questions 8 month Exp

Find two non repeating elements in an array of repeating elements

Generic Object Oriented Stack with Template

Top 10 Interviews Techniqes for Campus Interview in IIT NIT BITS for MTech

HackeEarth Flipkart’s Drone

FizzBuzz Solution C C++

Printing each word reverse in string

Sort an array according to the order defined by another array

Daughter’s Age VeryGood Puzzle

Password Predictor

Wrong Directions given find minimum moves so that he can reach to the destination

Stock Buy Sell to Maximize Profit

Copyright © 2026 · Genesis Framework · WordPress · Log in