On 17 Nov 2005 05:24:51 -0800, in comp.lang.c , "shan"
<sr**********@gmail.com> wrote:
shan wrote: How to return an two dimensional array in user defined function to main
function.
a) pass the array as a parameter to the function
int enter(int array[12][12]);
b) encapsulate the array in a struct, and return the struct
struct {array[12][12] } thearray;
struct thearray enter(void);
Both methods require you do define a max size for the array, or
alternatively use malloc to create some dynamic memory.
By the way, I would also pass pointers to rows and cols to enter(), so
that you don't need to define these globally.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----