Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdint.h>
- #define MAX_FRAMES 2
- uint32_t currentFrame = 0;
- int main()
- {
- for(uint32_t i = 0; i < 10; ++i)
- {
- printf("%d ", currentFrame);
- currentFrame = (currentFrame + 1) % MAX_FRAMES;
- }
- return 0;
- }
- /*
- output:
- when MAX_FRAMES 2:
- 0 1 0 1 0 1 0 1 0 1
- when MAX_FRAMES 3:
- 0 1 2 0 1 2 0 1 2 0
- */
Advertisement
Add Comment
Please, Sign In to add comment