int** foo()
{
int i;
int** array = malloc(100 * sizeof(int *));
for(i = 0; i < 100; i++)
array[i] = malloc(20 * sizeof(int)); // allocate 20 integers
return array;
}
int main()
{
int ** array = foo();
}
Last edited by Ancient Dragon; Mar 20th, 2009 at 7:45 am.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Online 21,950 posts
since Aug 2005