-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.c
More file actions
31 lines (23 loc) · 968 Bytes
/
array.c
File metadata and controls
31 lines (23 loc) · 968 Bytes
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
#include <stdio.h>
int main(){
char array[5] = "hello";
int arrayI[3] = {1,1,1};
float arrayF[2] = {1.0, 2.0};
printf("Size of int: %ld bytes\n", sizeof(int));
printf("Size of short int: %ld bytes\n", sizeof(short int));
printf("Size of long int: %ld bytes\n\n", sizeof(long));
printf("Size of float: %ld bytes\n", sizeof(float));
printf("Size of double: %ld bytes\n", sizeof(double));
printf("Size of short double: %ld bytes\n", sizeof(double));
printf("Size of long double: %ld bytes\n", sizeof(long double));
printf("Size of char: %ld bytes\n", sizeof(char));
printf("Size of byte: %ld bytes\n", sizeof(unsigned char));
printf("Size of void*: %ld bytes\n", sizeof(void*));
printf("Size of int*: %ld bytes\n", sizeof(int*));
printf("Size of char*: %ld bytes\n", sizeof(char*));
for(int i=0; i<sizeof(array)/sizeof(char); i++){
putchar(array[i]);
}
putchar('\n');
return 0;
}