Warren Robbins wrote: <snip beating around the bush...> > How can I get a valid 2-d variable sized array. For example, reading the > file above would determine I need: > char map[5][5]; > > However, C won't let me pass the size as arguments and create the variable > based on those arguments to a function. char **map = NULL; int x = 5, y = 5; int i; /* ... */ CREATE(map, char *, x); for (i = 0; i < x; i++) CREATE(map[i], char, y); Then in your cleanup you'd do.... for (i = 0; i < x; i++) free(map[i]); free (map); map = NULL; Regards, Peter +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST