Image

Imagepseudozero wrote in Imagelinux

c coding problem...

Im having some trouble with my c programming assignment and figured i would ask the community for help



if i try to free( structure ), {see below}
i get a "Debug error".. "DAMAGE after Normal block..."

ive abbreviated the code...

/*structure used for implementation of basic linked list*/
#include
[Error: Irreparable invalid markup ('<stdlib.h>') in entry. Owner must fix manually. Raw contents below.]

Im having some trouble with my c programming assignment and figured i would ask the community for help

<lj-cut text="If you know C, youre just the person i need to see">

if i try to free( structure ), {see below}
i get a "Debug error".. "DAMAGE after Normal block..."

ive abbreviated the code...

/*structure used for implementation of basic linked list*/
#include <stdlib.h>

typedef struct SNode* Node;
struct SNode{
char* Name;
Node Next;
};

int main()
{
Node newNode;
newNode = malloc(sizeof(Node));
newNode->Name = "Bill";
newNode->Next = NULL;

free(newNode); /*this is where the error occurs*/
return 0;
}

</lj-cut>

Any help would be appreciated and thanks in advance for any insight.

//Jared