Hi,
         check this....................

#include <stdio.h>
#include <sys/types.h>
#define my_sizeof(var) ((size_t)(&(var) + 1) - (size_t)(&(var)))

struct test {
        int a;
        int b;
};

struct test a1;
main()
{
        int num;
        char ch;
        printf("%d\n", my_sizeof(num));
        printf("%d\n", my_sizeof(ch));
        printf("%d\n", my_sizeof(a1));
}


Thanks & Regards,

Rajath N R

--- On Sun, 11/2/08, una_020 <[EMAIL PROTECTED]> wrote:
From: una_020 <[EMAIL PROTECTED]>
Subject: [c-prog] how to find size without using sizeof??
To: [email protected]
Date: Sunday, November 2, 2008, 7:28 AM










    
            1.how to find size of structure without using sizeof operator?



2.variable name i.e. identifier is given how to find it's size without 

using sizeof?




      

    
    
        
         
        
        








        


        
        


      

[Non-text portions of this message have been removed]

Reply via email to