Jump to content
  • Advertisement
Sign in to follow this  
pascalosti

how to get size of 2d array

This topic is 4408 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how can i get size of array from row and colum seperatly struct Matrix{ float m33[3][3]; float m44[4][4]; } chaos, enchant; int main(){ cout << sizeof(chaos.m33)<< endl; cout << sizeof(chaos.m44)<< endl; cout << sizeof(chaos.m33[0][0])<< endl; return 0; }

Share this post


Link to post
Share on other sites
Advertisement

float array[x][y]

rowsize = sizeof( float ) * x
colsize = sizeof( float ) * y

totalsize = sizeof( float ) * x * y
or
totalsize = sizeof( array )

Share this post


Link to post
Share on other sites
isnt there a command that goes something like

sizeof(first ->chaos.m33);

and second

edit
nevermind
I remember thats from the stl library for map or set

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!