Here is a small Program to print powers of 2 till 8. But it is not quitting after 8. Please explain the reason.
#include #include
2^8 is 2 XOR 8, ie. 10, not 256. hence your loop doesn't stop. You probably want to check against either (1<<8) or 256 specifically.
2^8
2 XOR 8
(1<<8)