:-/AnyWay,, Here is what it is supposed to happen....
The input is a char array initialized with line of Text,, the program should tokenizes the line with the "strtok" function and should output the line of text in reverse order....
I need to set up a "strcpy"..... I'm almost there just cant seem
to get this to work...
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
int _tmain(int argc, _TCHAR* argv[])
{
char string[30] = "I need to see this in reverse"; /* initialize char array */
char *revrseStrng[30]; /* create char array revrseStrng */
char *tokenPtr;
int i; /* counter */
/* copy contents of string into revrseStrn
printf( "%s%s\n%s%s\n",
"The string in array x is: ", string,
"The string in array y is: ", strcpy( revrseStrng, string ) );
*/
tokenPtr = strtok(string, " " );
/* NOT SURE HOW TO IMPLAMETN */
/* ?????????????????????????????? */
strcpy( *revrseStrng, string );
while(tokenPtr != NULL)
{
for ( i = 0; i < 30; i++)
{
revrseStrng[i] = tokenPtr;
}
tokenPtr = strtok(NULL, " " ); /* get next token */
}
for ( i = 30; i > 0; i--)
{
printf("%s ", revrseStrng[i]);
}
getch();
return 0;
}