I am compiling some code for a program that memoizes fibonacci numbers. The program works perfectly however when I compile in linux environment I get this warning before compiling.
line 61: warning: assignment makes pointer from integer without a cast [enabled by default]
Here is a snippet of code of where this warning is coming from, I'll try to show things of most relevance to get the best picture presented of the situation
int InitializeFunction(intStruct *p, int n)
p->digits = (int)malloc(sizeof(int) * 1);
if(p->digits == NULL)
handleError("Got error");
//making the one index in p->digits equal to n
p->digits[0] = n;
//incrementing a field of 'p'
p->length++;
//return 1 if successful
return 1;
This function is only called twice for a very specific purpose. it is used to initialize the two base cases in the fibonacci sequence f[0] = 0 & f[1] = 1. That's it's only purpose. So if I pass by reference the address of a specific index in an array of structs it's just supposed to initialize those values:
Initializer(&someIntStruct[0], 0) ----> after function -> someIntStruct[0] == 0
Initializer(&someIntStruct[1], 1) ----> after function -> someIntStruct[1] == 1
thoughts?