Wikipedia
en.wikipedia.org › wiki › Sizeof
sizeof - Wikipedia
January 11, 2026 - C++11 introduced the possibility to apply the sizeof parameter to specific members of a class without the necessity to instantiate the object to achieve this. The following example for instance yields 4 and 8 on most platforms.
Scaler
scaler.com › home › topics › sizeof() in c
sizeof() in C - Scaler Topics
January 12, 2024 - In the above example, we utilize the sizeof() operator, which is applied to an int data typecast. We use the malloc() method to allocate memory dynamically and return the pointer referring to that memory. The memory space is then multiplied by 10, where the memory space originally represented the number of bytes held by the int data type. Now the catch over here is that the output might alter depending on the computer, for example, a 32-bit operating system will produce different results, whereas a 64-bit operating system would produce different results for the same data types.
How sizeof works in C/C++
The nittiest of all nitpicks: According to the C Specification ISO/IEC 9899:TC3 Chapter 5.2.4.2.1 (the first one I could find on google) it is 1 byte (8 bits). A (C) byte is at least 8 bits, not necessarily exactly 8 bits. Of course, if you can give me a platform that's actually in common use today that doesn't have 8-bit bytes, I'll eat... well, I'll eat my lunch, which I'm about to do anyway. But I'll do it while surprised. :-) So here is the takeaway, since the space needed for a fixed size array (like arr1) is calculated at compile time, the compiler knows about it and by proxysizeof knows about it. All that the compiler knows about arrays allocated at runtime (likearr2) is that it is a int*, which in this case is 8bytes. Incidentally, post also dances around the fact that this example definitively establishes that "arrays are just pointers" is not true, and is a somewhat common misconception about C and C++. Arrays decay to pointers if you look at them funny, but that doesn't make them the same, and sometimes the differences can rear their head. Compare const char * s = "foo"; vs const char s[] = "foo"; for example (in the context of a global/static variable). (That will show up differently in other cases too.) More on reddit.com
Confuso da sizeof integer in C
e dice che per un intero, la dimensione minima in bit è 16. Quindi uso sizeof su una variabile int in questo modo: More on reddit.com
Confused by sizeof integer in C
It is bytes. Wikipedia says minimum size, it can be more and it is implementation specific. https://stackoverflow.com/questions/11438794/is-the-size-of-c-int-2-bytes-or-4-bytes More on reddit.com
Do the sizes of data types in C such as char, short, and int have specified minimum size or relative in the C standard?
You literally have the C standard linked above your post. Why wouldn't you read it, rather than asking chatGPT? https://www.reddit.com/r/C_Programming/comments/1ay92d4/latest_working_draft_n3220/ Read section 5.2.5.3.2 More on reddit.com
Videos
09:23
sizeOf Operator in C - C Programming Tutorial 33 - YouTube
08:34
sizeof operator in c programming - YouTube
05:16
C Programming Tutorial - 31: Sizeof Operator - YouTube
Lesson 23: C Programming - SizeOf - how many bytes does a ...
01:26
Sizeof Explained In 60 Seconds - YouTube
TutorialsPoint
tutorialspoint.com › cprogramming › c_sizeof_operator.htm
C - The sizeof Operator
#include <stdio.h> int main(){ ... type: 4 Size of double data type: 8 · In this example, we declare a struct type and find the size of the struct type variable....
Programiz
programiz.com › c-programming › examples › sizeof-operator-example
C Program to Find the Size of int, float, double and char
#include<stdio.h> int main() { int intType; float floatType; double doubleType; char charType; // sizeof evaluates the size of a variable printf("Size of int: %zu bytes\n", sizeof(intType)); printf("Size of float: %zu bytes\n", sizeof(floatType)); printf("Size of double: %zu bytes\n", ...
GeeksforGeeks
geeksforgeeks.org › c language › sizeof-operator-c
sizeof operator in C - GeeksforGeeks
Size of char: 1 bytes Size of int: 4 bytes Size of float: 4 bytes Size of double: 8 bytes Size of pointer: 8 bytes · Note: sizeof() may give different output according to machine, we have run our programs on a 64-bit gcc compiler.
Published October 17, 2025
EDUCBA
educba.com › home › software development › software development tutorials › c programming tutorial › sizeof() in c
sizeof() in C | What is the use of sizeof() function in C? (Examples)
April 6, 2023 - If a machine is 32 bits, then the memory allocation and other computation will work in the same way in a manner that the output will vary with a 32-bit machine and if it is 64 bits then it will vary with the 64 bits. Also, if the sizeof operator passes a parameter as expression then it will first parse the entire regular expression and then it will return an output with that size of the expression.
Call +917738666252
Address Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
W3Schools
w3schools.com › c › c_data_types_sizeof.php
C sizeof operator
Note that we use the %zu format specifier to print the result, instead of %d. This is because the compiler expects the sizeof operator to return a value of type size_t, which is an unsigned integer type.
Codecademy
codecademy.com › docs › operators › sizeof
C | Operators | sizeof | Codecademy
June 13, 2025 - This example demonstrates the practical use of sizeof in dynamic memory allocation. Using sizeof(int) ensures the correct amount of memory is allocated regardless of the platform’s integer size.
Linux Hint
linuxhint.com › sizeof_c_language
Sizeof() Operator in C Language – Linux Hint
The following image shows the compilation and execution of this code where you can see the result which corresponds to the number of bytes that each variable occupies according to its data type: The size of a given data type in bytes is obtained when the sizeof() operator is applied to the type declaration. For example, the following operation obtains the size of a data type int:
Javatpoint
javatpoint.com › size-of-operator-in-c
sizeof() operator in C - javatpoint
sizeof() operator in C with Tutorial or what is c programming, C language with programming examples for beginners and professionals covering concepts, control statements, c array, c pointers, c structures, c union, c strings and more.
CodeRivers
coderivers.org › c › c-basic › c-sizeof
Demystifying `sizeof` in C: A Comprehensive Guide - CodeRivers
February 22, 2026 - In this code, sizeof(arr) gives the total size of the array in bytes, and sizeof(arr[0]) gives the size of a single element. Dividing the two gives the number of elements in the array. The size of data types can vary across different platforms. For example, an int might be 2 bytes on some old ...
GitHub
github.com › portfoliocourses › c-example-code › blob › main › sizeof.c
c-example-code/sizeof.c at main · portfoliocourses/c-example-code
// sizeof(double) will typically ... · // We can also get the size in bytes of a variable · double x = 5; printf("sizeof x: %zu\n", sizeof x); ·...
Author portfoliocourses