hm.. thanx everyone..
On Fri, Jun 24, 2011 at 2:43 AM, D!leep Gupta <[email protected]>wrote:
> #include<stdio.h>
> main()
> {
> long double *var;
> printf("%d",(char*)(var+1)-(char*)var);
> return 0;
> }
>
> This also may be the solution... by taking the pointer of that variable...
>
> On Fri, Jun 24, 2011 at 2:09 AM, vaibhav shukla
> <[email protected]>wrote:
>
>> here is the generalized way
>>
>>
>> #include<stdio.h>
>> #define SIZEOF(var) (size_t)(&var+1) - (size_t)(&var)
>> main()
>> {
>> double x;
>> printf("The size of x is %d\n",SIZEOF(x));
>> return 0;
>> }
>>
>> On Fri, Jun 24, 2011 at 1:35 AM, Anika Jain <[email protected]>wrote:
>>
>>> #include<stdio.h>
>>>
>>> int main()
>>> {
>>> char x='9',size=0,count;
>>> while(x)
>>> {
>>> x = x<<1;
>>> count++;
>>> if((count=count%8)==0)
>>> {
>>> size++;
>>> }
>>> }
>>> printf("%d\n",size);
>>> return 0;
>>> }
>>>
>>> this code i tried to find size of a variable without using sizeof.. but
>>> its only for ints and chars... not general.. does anybody hava a general
>>> answer??
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> best wishes!!
>> Vaibhav Shukla
>> DU-MCA
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Dileep Kumar
> B.Tech 3rd Yr
> MNNIT, Allahabad
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.