-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchallenge4.c
39 lines (31 loc) · 1.02 KB
/
challenge4.c
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
/*
Source: Udemy - C Programming for Beginners - Master the C Language
Description: Create a C program that displays the byte size of basic data types supported in C.
Author: iStackz
Date: 7/15/2024
RULES:
*/
// directives
#include <stdio.h>
// main function.
int main(void)
{
// declare variables
int sizeOfInt;
float sizeOfFloat;
char sizeOfChar;
double sizeOfDouble;
long sizeOfLong;
long long sizeOfLongLong;
long double sizeOfLongDouble;
// display output. - the format string of sizeof is %zu
printf("size of an int is: %zu\n", sizeof(sizeOfInt));
printf("size of a float is: %zu\n", sizeof(sizeOfFloat));
printf("size of a char is: %zu\n", sizeof(sizeOfChar));
printf("size of a double is: %zu\n", sizeof(sizeOfDouble));
printf("size of long is: %zu\n", sizeof(sizeOfLong));
printf("size of long long is: %zu\n", sizeof(sizeOfLongLong));
printf("size of long double is: %zu\n", sizeof(sizeOfLongDouble));
// exit successfully
return 0;
}