Re: [Dev-C++] number of array elements!
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Matthews <dem...@uw...> - 2002-12-26 15:49:25
|
I believe strlen() would work in this case. It counts the number of characters in an array until it reaches the null terminator (which would be the '\0' character, making yours redundant.) At 12:01 PM 26/12/2002 +0000, Khalid El-Kary wrote: >Thanx for your help! > >i just wanted to add that i need something for C not C++ ;), so i decided to >end the arrays with "-1" and then check for it, that's only in case i have >no "-1" in the array itself! and that's the case here > >have a nice hard coding! :) > >Regards, >Khalid Al-kary > > > > > > >> >>well u stated you were a newbie, as i was, maybe still am. i've been doing >>C++ for around a year now and as a general matter of fact, arrays are >>REALLY far too primitive for any REAL application. now i dont know the case >>with C, but in C++ u can use the various standard container classes that >>come with C++, such a <vector> or <list>. each of these classes have a >>lenght or size functon that u can use. >> >>also, creating your own container classes really isnt too hard, u could >>write your own vector which allows u to check the size or something. i >>dunno. >> >>happy programming :) >> >>------------------------------------------------- >> >>Hi, >>i'm a newbie asking about how can i count the number of elements in a >>non-string array? is this possible? >> >>infact returning to the origin from where the array was initialized >>will >>affect the efficency--causing me to run the same function twise! >> >>thanx for any help >> >>Regards, >>Khalid Al-kary >>http://creaturesx.ma.cx/kxparse/ >> >> >> >> >> >>--------------------------------- >>Yahoo! Movies >>- What's on at your local cinema? > > >_________________________________________________________________ >Protect your PC - get McAfee.com VirusScan Online >http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |