Any Help would be appreciated... I have been taking the time to search the WWW for examples... And have found several good once but there not useing TOKEN....
AnyWay,, Here is what it is supposed to happen....
The user inputs a line of text,, tokenizes the line with the "strtok" function and should output the line of text in reverse order....
Cant seem to get passed some error on the back end...
Code:#include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <conio.h> int _tmain(int argc, _TCHAR* argv[]) { char string[100]; char *tokenPtr; char *reverse[100]; int i; /* counter */ printf( "Enter a line of text; "); scanf(string); printf( "\n" ); tokenPtr = strtok(string, " " ); while(tokenPtr != NULL) { for ( i = 0; i < 100; i++) { reverse [i] = tokenPtr; } tokenPtr = strtok(NULL, " " ); /* get next token */ } for ( i = 100; i > 0; i--) { printf("%s ", reverse[i]); } getch(); return 0;



LinkBack URL
About LinkBacks



