sizeof

Simple printf with sizeof does not work at all.

I got the most simple code to display sizeof() of a datatype, say an int. #include <stdio.h> int main() { printf('%i', sizeof(int)); } No matter what I do, such as put sizeof(int) into an integer, or use 'zu' instead of 'i', it hands me this error: error: invalid conversion from ‘int’ to ‘const char*’ Is there something wrong wi...

What's the size of this C# struct?

Is it 12 bytes or 16 bytes when stored in a List<DataPoint>? public struct DataPoint { DateTime time_utc; float value; } Is there any sizeof function in C#? ...

What is the difference between sizeof(int) and sizeof(int*)? Also Is this statement int* numbers[] = {....} correct?

Suppose, int numbers [20]; int * p; I think this is statement is valid p = numbers; But this is not numbers = p; Because numbers is an array, operates as a constant pointer, and we cannot assign values to constants. So if we go by this then we cannot use *numbers while initializing the array? ...

c programming query regarding sizeof operator Please specifythe output with reason in windows and linux

void main() { char c='0'; printf("%d %d",sizeof(c),sizeof('0')); } ...

What is the sizeof(main), sizeof(printf), sizeof(scanf)?

In the gcc compiler, sizeof(main), sizeof(printf) and sizeof(scanf) all are 1. I want to know how the size of all these are 1. What is the logic behind it? ...

sizeof empty structure is 0 in C and 1 in C++ why?

Possible Duplicates: Empty class in C++ What is the size of an empty struct in C? I read somewhere that size of an empty struct in C++ is 1. So I thought of verifying it. Unfortunately I saved it as a C file and used <stdio.h> header and I was surprised to see the output. It was 0. That means struct Empty { }; int main(v...

sizeof a struct member

Hello How can I get the size of a member in a struct in C? struct A { char arr[64]; }; i need something like that: sizeof(A::arr) thanks ...

sizeof(): where is the problem with calculation?

First of all, on my system the following hold: sizeof(char) == 1 and sizeof(char*) == 4. So simply, when we calculate the total size of the class below: class SampleClass { char c; char* c_ptr; }; we could say that sizeof(SampleClass) = 5. HOWEVER, when we compile the code, we easily see that sizeof(SampleClass) = 8. So the question...

What is guaranteed about the size of a function pointer?

In C, I need to know the size of a struct, which has function pointers in it. Can I be guaranteed that on all platforms and architectures: the size of a void* is the same size as a function pointer? the size of the function pointer does not differ due to its return type? the size of the function pointer does not differ due to its param...

sizeof: Operator or Function?

Possible Duplicate: Why is sizeof an operator? Why is sizeof supposed to be an operator in C, & not a function? Its usage seems similar to that of a function call, as in sizeof(int). Is it supposed to be some kind of a pseudo-function? ...

1 bit per bool in Array C++

bool fp[81]; From my understanding fp should use ceil(81/8) bytes because it is in succession. Am I correct? How can I prove this? ...

Sizeof unknown type object

I have to get size of object which type I does not know. It's a template where I want to achieve sth like this: void sth(T data) { System.out.println("Data size = ", sizeof(data)); } How I can do this in Java? sizeof - like a C sizeof ;) ...