C - Malloc causing segfault
Code:
#include <stdio.h> |
Quote:
Modify your code to become, say Code:
fprintf (stderr, "Good Thus Far 3\n"); |
The Mem_Stuff that you have declared is a 'pointer to a pointer to something'. You are treating it as a 'array of pointers', which is also fine. However, you have not made space for the array, so when you attempt to assign to one of the pointers, you get the fault.
You need to first allocate space for the array itself, before allocating the spaces that the pointer elements are going to point to. === edit - see above post! === |
Great, that helps a bunch. Thanks!
|
All times are GMT -5. The time now is 03:53 AM. |