prototyping (oh no! not again??)

Jody Hagins hagins at dg-rtp.dg.com
Wed Nov 28 05:30:41 AEST 1990


In article <1990Nov27.001813.9244 at ux1.cso.uiuc.edu>,
gordon at osiris.cso.uiuc.edu (John Gordon) writes:
|> 
|> 	Given that you are passing an n-dimensional array to a function,
you
|> *MUST* explicitly provide at least n-1 of the dimensions in the
argument
|> declaration.
|> 
|> 	For example:
|> 
|> 		if my_array is a 4-dimensional array, you *must* explicitly
|> provide at least 3 of the dimensions when you pass my_array to a
function.
|> 
|> 	main()
|> 	{
|> 	  int my_array[6][5][4][3];
|> 	  .
|> 	  .
|> 	  .
|> 	}
|> 
|> 
|> 	function_one(int array[6][5][4][])
|> 	{
|> 	  .
|> 	  .
|> 	  .
|> 	}
|> 
|> 	Note: There is a rule that governs which dimension may be left out;
I
|> think it is one of the end ones, but I am not sure which one.
|> 
|> 


Why can you not do the following?

	function_one(int *array)
	{
	  .
	  .
	  .
	}

You do not need to declare the size of the array (or number of
indecies)
and you can still access the individual elements of the array.


|> 
|> ---
|> John Gordon
|> Internet: gordon at osiris.cso.uiuc.edu        #include <disclaimer.h>
|>           gordon at cerl.cecer.army.mil       #include
<clever_saying.h>
|> 



Jody Hagins
hagins at gamecock.rtp.dg.com



More information about the Comp.lang.c mailing list