Sizeof?
#4

It depends.

For example, if you want to loop through all the indexes of an array, using sizeof will be correct (not that it shouldn't be "<= sizeof (...);" because that will cause run time error 4. You'll need to use either "<" or "!=". Also indexes on arrays start always from 0 and not 1.

If you have an array (such as for houses - an example) and you want to loop only through the houses that exist, then if you store in a global variable how many houses there are, you can loop using the first one (without the '=' sign as I mentioned above).
Reply


Messages In This Thread
Sizeof? - by TheSy - 04.06.2014, 18:27
Re: Sizeof? - by Koala818 - 04.06.2014, 18:37
Re: Sizeof? - by TheSy - 04.06.2014, 19:13
Re: Sizeof? - by Konstantinos - 04.06.2014, 19:22
Re: Sizeof? - by Deji - 04.06.2014, 19:27

Forum Jump:


Users browsing this thread: 1 Guest(s)