Re: [algogeeks] NVIDIA Q

2011-07-07 Thread T3rminal
struct t{}; int main(){ struct t a,b,c; int l; printf(%u %u %u %u\n,a,b,c,l); } o/p 3213845680 3213845680 3213845680 3213845676 a,b,c all are pointing to same location, so no space is allocated to them. As i already mentioned, *may be* . I dont know what standard says about it or rather i

[algogeeks] NVIDIA Q

2011-07-06 Thread Piyush Sinha
What is the size of an object of a class with no members in it?? -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread durgaprasad k
The size will be 1 byte as there is nothing to look into the object. And it is 1 instead of zero because two objects of the class will have different addresses by assigning each object size 1. Regards, Durga On Wed, Jul 6, 2011 at 2:11 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: What is

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread Piyush Sinha
thanks buddy..:) On 7/6/11, durgaprasad k durga...@gmail.com wrote: The size will be 1 byte as there is nothing to look into the object. And it is 1 instead of zero because two objects of the class will have different addresses by assigning each object size 1. Regards, Durga On Wed, Jul

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread Gunjan Agarwal
it is 8 bytes if you are talking about a java class On Wed, Jul 6, 2011 at 2:27 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: thanks buddy..:) On 7/6/11, durgaprasad k durga...@gmail.com wrote: The size will be 1 byte as there is nothing to look into the object. And it is 1 instead of

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread Gunjan Agarwal
that is why i mentioned if you are talking about a 'java class' On Wed, Jul 6, 2011 at 2:39 PM, Vivek Srivastava srivastava.vivek1...@gmail.com wrote: It is a more standard question when we consider c++,as the minimum size of any object is 1 byte. On Wed, Jul 6, 2011 at 2:35 PM, Gunjan

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread T3rminal
@ashish Most probably because empty struct in C have nothing associated with it. They are as good as nothing. But empty classes in C++ can have member functions. These functions need to be associated with object, having a unique address, for that class. And unique address is not possible with

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread Ashish Modi
@piyush: No,one can declare the variable of empty struct and access its address via pointer. So, when you are accessing address via pointer means some memory is allocated for that variable. But *sizeof()* operator returns *zero*?? why??? On Wed, Jul 6, 2011 at 10:38 PM, T3rminal

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread oppilas .
Ok. So for differentiating objects, we have size 1. What will be size of following class:- class A{ int z; }; How does different objects gets differentiated in above case? On Wed, Jul 6, 2011 at 2:24 PM, durgaprasad k durga...@gmail.com wrote: The size will be 1 byte as there is nothing to

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread Navneet Gupta
In this case, i think we will get sizeof(int) size of class because here the objects will automatically be referring to different memory location because of non-zero class size. Empty class looks like a special case where 'bonus' size is allocated. On Thu, Jul 7, 2011 at 11:04 AM, oppilas .