Hi, I'm new to C programming and I'm trying to create code ( it's part of a larger program) which creates linked list of country codes. Basically I'm getting the country codes inputted from the user which I store in a structure and then I created a separate structure (as requested in assignment question) which will store the country code.
I'm getting the following error:
error C2143: syntax error : missing ';' before '.'
This is part of the code :
Code:
void enterclientrecord(const clientrecord_type *clientrecord, listCode** startPtr)
{
scanf("%s",clientrecord->countrycode);
insertCode(startPtr, clientrecord->countrycode);
};
void insertCode(listCode **startPtr, const char *countryCode)
{
listCode *prevNode = NULL, *curNode = *startPtr;
listCode *newNode = (listCode*)malloc(sizeof(listCode));
listCode.countryCode = countryCode; //ERROR IS GIVEN HERE
newNode->nextPtr = NULL;
while ((curNode != NULL)&&( strcmp(newNode->countryCode , curNode->countryCode) > 0 ) )
{
prevNode = curNode;
curNode = prevNode->nextPtr;
};
if (prevNode==NULL)
{
*startPtr=newNode;
}
else
{
prevNode->nextPtr = newNode;
};
newNode->nextPtr = curNode;
};