Re: [algogeeks] without sizeof

2011-06-24 Thread Anika Jain
hm.. thanx everyone.. On Fri, Jun 24, 2011 at 2:43 AM, D!leep Gupta wrote: > #include > 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, vaib

Re: [algogeeks] without sizeof

2011-06-23 Thread D!leep Gupta
#include 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 wrote: > here is the generalized way > > > #include > #define SIZEOF(var) (size_t)(&v

Re: [algogeeks] without sizeof

2011-06-23 Thread vaibhav shukla
here is the generalized way #include #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 wrote: > #include > > int main() > { > char x='9',size=0,count; > while(x) >

[algogeeks] without sizeof

2011-06-23 Thread Anika Jain
#include 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 it