Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys!
In my program I have defined 2-D array of string as follows

char str[10];//normal character array
char word[10][100]={
"apple-a fruit","elephant-an animal","cricket-a game"}; //2-D array


If I want to process a string "apple" from "apple-a fruit"
then how should I store "apple" in str.
and then again for processing "elephant" from "elephant-an animal", str should contain nothing.

How should I do it?
Posted
Updated 5-Apr-10 1:33am
v2

1 solution

One method you can try would be to use strtok(). Here's an example[^] of it's use.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900