I've searched and then read almost every post I could find about these subjects, but just cannot get anywhere on my program.
Code:
list insertAfter (list x, char *s) {
//Insert a new element containing s after the current element.
//Make the new node the current node.
listNodePtr temp = (listNodePtr) malloc(sizeof(listNodePtr));
char *tempString;
printf("%d is the length of s\n", strlen(s));
tempString = malloc(strlen(s) + 1 );
strcpy(tempString, s);
printf("we are trying to INSERT: %s\n", s);
if (x -> currentNode != NULL && x -> currentNode -> nextNode != NULL) {
strcpy(temp -> data, tempString);
.....
temp -> data is a char*. I get an error whenever I try to:
strcpy(temp -> data, tempString). I get the idea of what I need to do, I just cannot figure it out for the life of me. Help!