Skip to content

Instantly share code, notes, and snippets.

@mnzk
Created March 25, 2012 10:28
Show Gist options
  • Save mnzk/2192729 to your computer and use it in GitHub Desktop.
Save mnzk/2192729 to your computer and use it in GitHub Desktop.
sum10.c
#include <stdio.h>
typedef struct {unsigned short total, count; } s;
#define M_COUNT(x) (((s*)&x)->count)
#define M_TOTAL(x) (((s*)&x)->total)
int main(){
int x = 0;
for(M_COUNT(x)=1; M_COUNT(x)<=100; ++M_COUNT(x)){
M_TOTAL(x) += M_COUNT(x);
}
printf("result = %d\n", M_TOTAL(x));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment