1)The very first problem is what my compiler tells me when I try to compile this program
segfault.c:27: warning: ‘c’ is used uninitialized in this function
printf("error...""no memory left");
What are the intentions here? Firstly you are not initializing 'c' and then directly checking it for NULL ???
c[k]=(double *)malloc(*b/15 * sizeof(double));
c[k] means *(c+k). Which is value at address held at memory location 'c+k', but does the memory location 'c+k' belong to any variable in our program?
This is a problem as we are trying to access the stack address which does not belong to any variable of our program.
I could not go through the entire program as its quite messy. Can you explain what are you trying to achieve through this program?