Thread: Dividing sentence into words

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    38

    Dividing sentence into words

    I have a sentence in a char array and want to parse it and divide it on the basis of spaces,each word got assigned to a specific array.How can I do that?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Try searching for previous posts on strtok
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dividing a string to words
    By bahada in forum C Programming
    Replies: 15
    Last Post: 04-21-2009, 06:54 AM
  2. Begginer Problem: Extracting words from sentence
    By barlas in forum C++ Programming
    Replies: 5
    Last Post: 05-04-2006, 03:17 PM
  3. New Theme
    By XSquared in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 04-01-2004, 08:00 PM
  4. Searching for words within a sentence
    By drdroid in forum C++ Programming
    Replies: 4
    Last Post: 02-27-2003, 12:09 AM