Now that I am used to programming in very memory constraint conditions, one question which I dont have an answer is : Which is more memory efficient;- for(;;) or while() ? Or are they interchangeable equally? Also comment on efficiency matters if any!
There is no difference in memory use between the programming language construct for
and while
. A given compiler might optimize one or the other better but you should not worry about this. With memory constraint conditions the most important thing is going to be your data structures and system design. A poor system design could require more memory.
The only way to be sure is to test it with your compiler for your platform. But I suppose any sufficiently advanced optimizing C compiler would optimize them to the same thing in most cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With