I need to set up a "strcpy"..... I'm almost there just cant seem
to get this to work... Also you stated "I needed more space"...
I believe you speaking to my array size... but not sure...
AnyOne got any more suggestions... I'm still working it....
Code:
#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, " " );
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;
}