680 views
0 votes
0 votes
/*  sizeof(int)=4;
sizeof(float)=8;
sizeof(unsigned char)=1  ;   */

What is the output of the following program ?

#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    union Data{
        int i;
        float f;
        unsigned char str[20];
    }data;
    printf("size =%d\n",sizeof(data));
    data.i=10;
    data.f=220.5;
    printf("data.i: %d\n",data.i);
    return 0;
}

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
1
amitarp818 asked Sep 23, 2023
225 views
I am unable to find any links to NPTEL assignments for any subject. Can anyone tell me how to find the list of the assignments?or give me the links to assignments…….....
1 votes
1 votes
1 answer
3
0 votes
0 votes
0 answers
4
Amit puri asked Dec 28, 2021
273 views
Please post the solution answer is option B.