Re: [Dev-C++] How to get the number of elements in an array
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Mohammed I. <mi...@ac...> - 2004-01-20 15:45:09
|
n_of_elements=sizeof(Buf)/sizeof(Buf[0]); Mohammed ----- Original Message ----- From: "Daniel Glenfield" <sp...@ho...> To: <dev...@li...> Sent: Tuesday, January 20, 2004 1:49 PM Subject: [Dev-C++] How to get the number of elements in an array > This is an easy Q I know but I can't think how to do it... > > Size = 9; // Decided by a function but set to 9 for this example > > int* Buf = new int[Size]; > > int Tmp = sizeof(Buf); > > This can't be right. How do I get the size? Len(Buf) and Length(Buf) are not > recognised (I thought they were functions but I guess not). > > Any thoughts? > > _________________________________________________________________ > Use MSN Messenger to send music and pics to your friends > http://www.msn.co.uk/messenger > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |