Find out size of any union without using sizeof operator?

Answer:
union  ABC{
    int a;
    float b;
    char c;
};
void main(){
    union ABC *ptr=(union ABC *)0;
    ptr++;
    printf("Size of union is: %d",*ptr);
}


Explanation:
Read pointer arithmetic

Post a Comment