using the standard function in atoi() wont work. it gives me an error that says "assignment makes pointer from integer without a cast"

this is sample of the code..

struct integer* convert_integer(char* stringInt)
{
   struct integer* convertedInt_1;

   char* stringArray3 = (char *) malloc (sizeof(char));;
   free(stringArray3);


   stringArray3 = stringInt;
   convertedInt_1->digits = atoi(stringArray3);

   stringArray4 = stringInt;

so what is the proper way to convert this dynamically allocated string array into a dynamicallly allocated integer array

Whoa!

This is no way to code! Take a break from the keyboard and learn how to work with arrays a bit more.

This:

char* stringArray3 = (char *) malloc (sizeof(char));;
   free(stringArray3);

Is mind-numbing stuff. After you free an array, it's GONE to Byte Heaven (or Hell), and it ain't coming back. ;)

You know you have allocated just ONE char, right? Even a 1 char string array needs two char elements in the array to hold it - one for the char, and one for the end of string marker: '\0', that all strings in C MUST have.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.