Finding Available Length Of Strings...
Richard A. O'Keefe
ok at goanna.cs.rmit.oz.au
Sat Nov 10 20:27:17 AEST 1990
In article <16758 at hydra.gatech.EDU>, gt4512c at prism.gatech.EDU (BRADBERRY,JOHN L) writes:
> Just a note of clarification here...I am talking about a character array
> and I am looking for a solution (not the obvious '...add another length
> parameter')...I would like the function to be able to 'figure it out!'
When you pass an array to a function, the function gets a pointer.
Even ANSI C has no way of declaration a function argument that really
_is_ an array. The syntax "SomeType an_arg[]" declares a pointer.
That pointer looks just like any other pointer into that array.
The function can't even find the _beginning_ of the array, let alone
the end. (Not portably, at any rate.)
If you want your function to receive things like one-dimensional arrays
in Smalltalk or Lisp or Pop or Algol 68 or PL/I, then you'll have to
implement that data structure yourself using C primitives.
--
The problem about real life is that moving one's knight to QB3
may always be replied to with a lob across the net. --Alasdair Macintyre.
More information about the Comp.lang.c
mailing list