Article View: comp.std.c
Article #4432Re: Multi-Dimensional Array Passing
From: Paul A. White
Date: Tue, 05 Dec 1995 15:54
Date: Tue, 05 Dec 1995 15:54
21 lines
1628 bytes
1628 bytes
Paul A. White (pwhite@cse.utoledo.edu) wrote: : While tutoring some students in a Unix and C class, I came across a : problem of my own. I was trying to pass a multi-dimensional array to : and from functions via address. The problem arose when trying to : refernce(for this instance a 2D array) the array as it was defined. : For instance: : int matrix[20][20]; : is referenced matrix[i][j]. Now when that is passed to a function, : it can only be referenced as a single dimensional array, matrix[x], : where the limit on x is i*j. This was my only solution, and I was curious : if there is some other way to pass or cast the variable so that it can : be referenced the same way it is defined. I included a simple sample : program in hopes of clarifying my question. Please send any replies : to pwhite@cse.utoledo.edu, I don't get around to reading the newsgroups : as often as I like. : Thank You I apologize for posting this in this newsgroup, it does not belong here, I found that out quickly from all of the flames I received, I did receive a lot of solutions, thank you to those who helped me, and to those of you who flamed me, Sorry I posted in the wrong newsgroup, and piss off!
Technical Details
Message-ID:
<DJ4Euo.6zB@utnetw.utoledo.edu>Path:
arc1-ca.pugleaf.net!utnetw.utoledo.edu!jupiter!pwhiteReferences:
<DJ18AG.6qJ@utnetw.utoledo.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!utnetw.utoledo.edu!jupiter!pwhite From: pwhite@cse.utoledo.edu (Paul A. White) Subject: Re: Multi-Dimensional Array Passing Message-ID: <DJ4Euo.6zB@utnetw.utoledo.edu> Sender: news@utnetw.utoledo.edu (News Manager) Organization: University of Toledo X-Newsreader: TIN [version 1.2 PL0] References: <DJ18AG.6qJ@utnetw.utoledo.edu> Date: Tue, 5 Dec 1995 15:54:23 GMT