I am trying to understand when exactly a variable get memory in C when declared inside main function . I found a similar question When does memory get ...
I am trying to understand when exactly a variable get memory in C when declared inside main function . I found a similar question When does memory get ...
I am trying to get the size of a derived class, but I can't... The output is always 8! ...
How does sizeof() calculate that array1 is 3 bytes instead of 4 since I assigned a value to the 4th byte of memory allocated to the array? array2 ...
can anyone please help me with this question why it is printing float and why it is giving 4 for the sizeof(x==2) and can anyone help me with the fl ...
Having trouble C language debug step into process decimal point operator in a floating point sting of numbers. Example: 1234.5678, itoa() output stops ...
EDIT: I am new here. If my question is not presented correctly, I would appreciate some feedback with your downvote. Thank You. I have this exercise: ...
Since size and limits of data-types of c++ could vary depending on architecture, i want to be sure their fidelity. Second code block i share below, ho ...
Code Output: I was expecting 4 bytes to be assigned for x since the long int is bitfielded, 33 bits -> 4 + 4 bytes are assigned to it b ...
I typed this program from Boris Allen's book C programming: principles & practice on pg18 using Dev-C++ 5.11, its supposed to produce the followin ...
Hi I am just starting to learn cpp and I have two examples of getting the size of a vector in the for statements both seem to work but which is right ...
In the output, there is only water is printed, but no soda is printed. But in my opinion, soda has less size, it should be easily saved in x because x ...
Code: #include <iostream> #include <type_traits> int main() { std::cout << "sizeof(size_t): " << sizeof(size_t) << s ...
I have heard that when using an array as a function argument, the compiler takes it as not actually an array but as a pointer to the 1st element of th ...
A recent code sample i saw: How does sizeof(*ptr) even work? How can a undefined pointer be dereferenced and be given to sizeof() and yield t ...
For the below code. The output is 'a' represents the whole array (Also, the address of the first element of the array since it is a 1D array), a ...
I am not sure what is happening here. Does line 1 (in the snippet above) mean n now simply is a pointer to an int? And we have started using the mem ...
My allocation works partially. However I dont understand the use of sizeof(). Also *num, I thought the correct use would be (unsigned short*)num I ge ...
As much as I know, sizeof can only know size of something, if the size is determined at runtime. If I give input 10, sizeof says the size of the ar ...
Output: Why does the char pointer increment by one byte only? Its size is 8, right? When ptr is declared, the compiler allocates 8 bytes to it. W ...
I came across one simple (maybe over simplified) implementation of the sizeof operator in C, which goes as follows: #include <stdio.h> #defin ...