Created
April 26, 2012 07:03
-
-
Save ywatase/2496997 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <time.h> | |
enum { | |
MAX = 10, | |
}; | |
typedef struct Nameval Nameval; | |
struct Nameval { | |
char *name; | |
int value; | |
}; | |
void main(){ | |
Nameval htmlchars[] = { | |
"AEIig" , 0x00c6, | |
"Aacute" , 0x00c1, | |
"Acirc" , 0x00c2, | |
"zeta" , 0x03b6, | |
}; | |
Nameval *p1, *p2; | |
printf("sizeof int: %d\n",sizeof(int)); | |
printf("sizeof long: %d\n",sizeof(long)); | |
printf("sizeof char*: %d\n",sizeof(char*)); | |
printf("sizeof Nameval: %d\n",sizeof(Nameval)); | |
printf("%p\n", p1 = &htmlchars[0]); // | |
printf("%p\n", p2 = &htmlchars[2]); | |
printf("%d\n", p2 - p1); | |
printf("%d\n", (void*)p2 - (void*)p1); | |
printf("%d\n", (long*)p2 - (long*)p1); | |
} | |
int is_odd_number(int n) { | |
printf("%f: %f \n", (float) n, (float) (n % 2)); | |
} | |
#define NELEMS(array) (sizeof(array) / sizeof(array[0])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment