From f0c4dffb0383b8fd3fd0d676b45fa47e2a51f4bc Mon Sep 17 00:00:00 2001 From: harunnasaito Date: Fri, 24 Oct 2025 10:23:54 +0200 Subject: [PATCH] Update sizeof_types.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #include int main() { printf("Tailles des types de base en C (en octets) :\n\n"); // Types caractères printf("char (signed) : %zu octet(s)\n", sizeof(signed char)); printf("char (unsigned) : %zu octet(s)\n", sizeof(unsigned char)); // Types entiers courts printf("short (signed) : %zu octet(s)\n", sizeof(signed short)); printf("short (unsigned) : %zu octet(s)\n", sizeof(unsigned short)); // Types entiers printf("int (signed) : %zu octet(s)\n", sizeof(signed int)); printf("int (unsigned) : %zu octet(s)\n", sizeof(unsigned int)); // Types long printf("long int (signed) : %zu octet(s)\n", sizeof(signed long int)); printf("long int (unsigned) : %zu octet(s)\n", sizeof(unsigned long int)); // Types long long printf("long long (signed) : %zu octet(s)\n", sizeof(signed long long int)); printf("long long (unsigned) : %zu octet(s)\n", sizeof(unsigned long long int)); // Types à virgule flottante printf("float : %zu octet(s)\n", sizeof(float)); printf("double : %zu octet(s)\n", sizeof(double)); printf("long double : %zu octet(s)\n", sizeof(long double)); return 0; } --- TP1/src/sizeof_types.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/TP1/src/sizeof_types.c b/TP1/src/sizeof_types.c index e69de29b..cd23de41 100644 --- a/TP1/src/sizeof_types.c +++ b/TP1/src/sizeof_types.c @@ -0,0 +1,32 @@ +#include + +int main() { + printf("Tailles des types de base en C (en octets) :\n\n"); + + // Types caractères + printf("char (signed) : %zu octet(s)\n", sizeof(signed char)); + printf("char (unsigned) : %zu octet(s)\n", sizeof(unsigned char)); + + // Types entiers courts + printf("short (signed) : %zu octet(s)\n", sizeof(signed short)); + printf("short (unsigned) : %zu octet(s)\n", sizeof(unsigned short)); + + // Types entiers + printf("int (signed) : %zu octet(s)\n", sizeof(signed int)); + printf("int (unsigned) : %zu octet(s)\n", sizeof(unsigned int)); + + // Types long + printf("long int (signed) : %zu octet(s)\n", sizeof(signed long int)); + printf("long int (unsigned) : %zu octet(s)\n", sizeof(unsigned long int)); + + // Types long long + printf("long long (signed) : %zu octet(s)\n", sizeof(signed long long int)); + printf("long long (unsigned) : %zu octet(s)\n", sizeof(unsigned long long int)); + + // Types à virgule flottante + printf("float : %zu octet(s)\n", sizeof(float)); + printf("double : %zu octet(s)\n", sizeof(double)); + printf("long double : %zu octet(s)\n", sizeof(long double)); + + return 0; +}