--- In [email protected], "Pankaj Mishra" <[EMAIL PROTECTED]> wrote:
>
>  
> 
> One way Which I could think of is to take diff of the addresses of
two variables defined consecutively.
> 
>  
> 
> #define mysizeof(x) (int)&(x)[1] - (int)&(x)[0]
> 
> int main()
> 
> {
> 
>   int a = 4;
> 
>   int intsize = mysizeof(&a);
> 
>   char ab = 'A';
> 
>    int charsize = mysizeof(&ab);
> 
>   return 0;
> 
> }
 
Hi Pankaj

Code is almost fine but the result is still Implementation Dependent.
 
> Any way still I would like to know why you would like to stay away
from using 'sizeof '?
 
Mee too.  
 








To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/c-prog/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to