Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <limits.h>
- int main(void)
- {
- long int *p;
- /*
- * malloc() always provides aligned memory.
- * Do not use stack variable like a[9], depending on the compiler you use,
- * a may not be aligned properly.
- */
- p = malloc(sizeof(long int));
- memset(p,0,8);
- *p = 0x7fffffffffffffffL;
- printf("%ld\n\n", *p);
- printf("Size of int:%zd\n", sizeof(int));
- printf("Size of unsigned int:%zu\n", sizeof(unsigned int));
- printf("Size of long int:%zd\n", sizeof(long int));
- printf("Size of long long int: %zd\n\n", sizeof(long long int));
- printf("INT_MAX=%d\n", INT_MAX);
- printf("UINT_MAX=%u\n", UINT_MAX);
- printf("LONG_MAX=%ld\n", LONG_MAX);
- printf("ULONG_MAX=%lu\n", ULONG_MAX);
- printf("LLONG_MAX=%lld\n", LLONG_MAX);
- printf("ULLONG_MAX=%llu\n", ULLONG_MAX);
- return 0;
- }
Add Comment
Please, Sign In to add comment