X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: function question Date: 5 Apr 2004 12:03:03 GMT Organization: Aachen University of Technology (RWTH) Lines: 44 Message-ID: References: <106vune1fu63e7a AT corp DOT supernews DOT com> <1071n4u4qfhn0a2 AT corp DOT supernews DOT com> <1072d9b9h7blrb8 AT corp DOT supernews DOT com> NNTP-Posting-Host: ac3b07.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 1081166583 25306 137.226.33.205 (5 Apr 2004 12:03:03 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 5 Apr 2004 12:03:03 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Bill Cunningham wrote: > I've seen this in either k&r2 or a C++ book. Can't remember which. That's a symptom of a serious error in your approach to learning these languages. You're utterly confusing yourself by trying to learn two things at the same time and not distinguishing between them clearly. Make sure you know what it is what you're trying to learn: C or C++. For the moment, I suggest you lock away *all* your books that mention C++ in their title and concentrate on learning C first. Only once you actually mastered C you should get out the C++ stuff again and learn that language. > An array say char array1[]={}; You almost certainly won't have seen exactly this in any C or C++ book of reasonable quality --- it's wrong, in both languages. You could have seen char array1[] = {1, 3, 5, 7}; though, which is valid code to initialize the array with a known set of value whose length also determines the size of the array object. Even so, it's still not valid to use an initializer in a function argument declaration, i.e. int ma(int np[] = {1,3,5,7}) would still be nonsense, at least in C. > It's initializing an array to how a yet indetermined number of > elements. Such a thing doesn't exist. You can't initialize an object to a value you don't know. If at all, the above would create a zero-element array --- but that would be completely useless, and is thus forbidden. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.