Re: [Dev-C++] Number of elements of a multidimensional
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Carlos d. M. <cg...@wo...> - 2002-11-28 16:57:14
|
The sizeof applied to a array will give you the size of a pointer, never the size of the array. Say char *array; or char array[]; Then sizeof(array) =3D 4. (at least in my intelIII x86, with win2k 4 is the size for any kind of pointer). The only solution is to have some special value for the end of the array. Which for strings is '\0', and you can try to set another depending on which kind of data you're working with and which range of values you can find, so you can then choose on of the values which are out of the range to set as that special value. So you can reach for it and you can then now, with the approppriate functions you can write the total size of the array and the size of each row of the multidimensional array. Samuel Keding escribi=F3: > Isn't there a keyword sizeof in C/C++? It seems like I > remember one but I've never had to use it. I think > there is one and I think it returns the number of > bytes in the array of objects. All you would have to > do is divide by the number of bytes that is in just > one object. I may be off on this. Like I said, I > haven't really had to use this before. > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com > > ------------------------------------------------------- > This SF.net email is sponsored by: Get the new Palm Tungsten T > handheld. Power & Color in a compact size! > http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en > _______________________________________________ > 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 |