-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathranges.c
More file actions
53 lines (47 loc) · 2.11 KB
/
Copy pathranges.c
File metadata and controls
53 lines (47 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* Author: Chris Bourke
*
* This program outputs data on the limits of various
* data types.
*/
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <float.h>
int main(int argc, char **argv) {
//character types
printf("\nData type: character type.\n");
printf("Minimum value for signed char: %d.\n", SCHAR_MIN);
printf("Maximum value for signed char: %d.\n", SCHAR_MAX);
printf("Minimum value for unsigned char: %d.\n", 0);
printf("Maximum value for unsigned char: %d.\n", UCHAR_MAX);
printf("Minimum value for char: %d.\n", CHAR_MIN);
printf("Maximum value for char: %d.\n", CHAR_MAX);
printf("Size of signed char: %ld byte.\n\n", sizeof(signed char));
//integers
printf("Data type: integer.\n");
printf("Minimum value for signed short: %d.\n", SHRT_MIN);
printf("Maximum value for signed short: %d. \n", SHRT_MAX);
printf("Size of signed short: %ld bytes.\n\n", sizeof(signed short));
printf("Minimum value for unsigned short: %d.\n", 0);
printf("Maximum value for unsigned short: %d.\n", USHRT_MAX);
printf("Size of unsigned short: %ld bytes.\n\n", sizeof(unsigned short));
printf("Minimum value for signed int: %d\n", INT_MIN );
printf("Maximum value for signed int: %d\n", INT_MAX );
printf("Size of signed int: %ld bytes.\n\n", sizeof(signed int));
printf("Minimum value for unsigned int: %u\n", 0 );
printf("Maximum value for unsigned int: %u\n", UINT_MAX );
printf("Size of unsigned int: %ld bytes.\n\n", sizeof(unsigned int));
printf("Minimum value for signed long: %ld\n", LONG_MIN );
printf("Maximum value for signed long: %ld\n", LONG_MAX );
printf("Size of signed long: %ld bytes.\n\n", sizeof(signed long));
printf("Minimum value for unsigned long: %d\n", 0 );
printf("Maximum value for unsigned long: %lu\n", ULONG_MAX );
printf("Size of unsigned long: %ld bytes.\n\n", sizeof(unsigned long));
//floating point types
printf("Data type: floating-point.\n");
printf("Size of float: %ld bytes.\n", sizeof(float));
printf("Size of double: %ld bytes.\n", sizeof(double));
printf("Size of long double: %ld bytes.\n", sizeof(long double));
return 0;
}