Find out size of any union using pointer?

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