Code:
typedef struct dep_db
{
char name[NAME_LENGTH + 1];
char ssn[SSN_LENGTH + 1];
struct dep_db* next;
} DEP_DB_T;
void print_links( const DEP_DB_T* ptr );
DEP_DB_T* get_links( void);
DEP_DB_T* get_links( void )
{
DEP_DB_T *current, *first;
int response;
current = first = malloc( sizeof(DEP_DB_T) );
printf ("\n\n\tEnter First Item --> ");
scanf ( "%s", current -> name );
printf ("\n\n\n\tAdd Another? --> 1==y 0==n");
scanf ("%d", &response);
while (response)
{
if ((current->next = malloc( sizeof ( DEP_DB_T ) ) ) == NULL )
{
printf ("Youre out of memory");
return first;
}
current = current -> next;
printf ("\n\n\tNAME: ");
scanf ( "%s", current -> name );
printf ("\n\n\n\tAdd Another? --> 1==y 0==n");
scanf ("%d", &response);
}
current -> next = NULL;
return first;
}
void print_links ( const DEP_DB_T* ptr )
{
int count = 1;
printf ("\n\n\n" );
while ( ptr != NULL)
{
printf ("\nnumber %d is %s.", count++, ptr -> name);
ptr = ptr -> next;
}
}
When I try to compile i get the following
ANSI C++ forbids implicit conversion from "void *" in assignment?
I am so confused...
Please Help!!
- shane