Thanks everyone for your previous advice/help. Starting to finally grasp the C/C++
Right now I'm trying to convert some C code originally written for Solaris to a windows 32 console program.
In main, I declare MOLECULE *m = NULL;
Another function named initmole uses this variable. The following error happens on initmole.cpp:
I'm still not really following what malloc does, but it seems like it has to do with this error because it errors on that line.
Here's the code for initmole.cpp:
Does anyone know what's going on or can give me some advice on how to handle this?
Thanks
James
Right now I'm trying to convert some C code originally written for Solaris to a windows 32 console program.
In main, I declare MOLECULE *m = NULL;
Another function named initmole uses this variable. The following error happens on initmole.cpp:
Code:
error C2440: '=' : cannot convert from 'void *' to 'MOLECULE *'
Here's the code for initmole.cpp:
Code:
/*==========================================================================*/
/* InitMol() */
/* */
/* Create a molecule connection table and initialize its entries. */
/* */
/* Argument list: void */
/* */
/* Return value: MOLECULE * pointer to created connection table */
/* */
/*==========================================================================*/
#include "stdafx.h"
#include <stddef.h>
#include <stdlib.h>
#include "molecule.h"
MOLECULE *InitMol( void )
{
MOLECULE *m;
if ( (m = malloc( sizeof( *m ) )) == NULL ) {
return( NULL );
}
m->N_Hydro = -1;
m->N_Atoms = 0;
m->N_Bonds = 0;
m->N_Comps = 0;
return( m );
}
Does anyone know what's going on or can give me some advice on how to handle this?
Thanks
James