hi .
how can I allocate a 2 dimensions array?
I used :
{
int i;
/* Allocating the rows */
Schedule = \(int **\)\( malloc\( sizeof\(int*\) * \(N-2\) \) \);
if\( Schedule == NULL \)
\{
printf\("\\nError - couldn't allocate memory! Aborting...\\n"\);
exit\(-1\);
\}
/* Allocating memory for columns */
for\( i = 0; i < N - 1; i\+\+ \)
\{
Schedule [i]= \(int *\)\( malloc\( sizeof\(int\) * N \) \);
if\( Schedule [i]== NULL \)
\{
printf\("\\nError - couldn't allocate memory! Aborting...\\n"\);
exit\(-1\);
\}
\}
return;
}
end of quote!
but it doesn't allocate the array .... when I use : "Schedule[0][0] = 1;" , for example , I get "segmetation fault" .
Thanks , Azran .