Skip to content

Instantly share code, notes, and snippets.

@rasgo-cc
Last active November 14, 2015 00:28
Show Gist options
  • Save rasgo-cc/6903c1c165fcd4b891db to your computer and use it in GitHub Desktop.
Save rasgo-cc/6903c1c165fcd4b891db to your computer and use it in GitHub Desktop.
Decrement integer without volatile
#include <stdio.h>
#include <stdint.h>
#include <time.h>
int main()
{
puts("Lets go");
time_t t;
int elapsed_time = time(&t);
uint32_t i = 999999999;
for( ; i > 0 ; i--);
elapsed_time = time(&t) - elapsed_time;
printf("Elapsed time: %ds\n", elapsed_time);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment