Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
int arr[] = {10,123,14,14,15,16}; cout<<sizeof(arr)/sizeof(arr[0]); I was reading the article. When sizeof() is used with the data types such as int, float, char… etc it simply ret...
#1: Initial revision
How allocated memory is calculated?
<span id="code"> ```c++ int arr[] = {10,123,14,14,15,16}; cout<<sizeof(arr)/sizeof(arr[0]); ``` </span> I was reading [the article](https://www.geeksforgeeks.org/sizeof-operator-c/). >When sizeof() is used with the data types such as int, float, char… etc it simply returns the amount of memory is allocated to that data types. How the memory is calculated? Is there any equation to find that without any code?