Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!rochester!cornell!uw-beaver!zephyr.ens.tek.com!uunet!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: Finding Available Length Of Strings... Message-ID: <4231@goanna.cs.rmit.oz.au> Date: 10 Nov 90 09:27:17 GMT References: <16752@hydra.gatech.EDU> <16758@hydra.gatech.EDU> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 19 In article <16758@hydra.gatech.EDU>, gt4512c@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.