/*memory allocate by the union and structure*/
#include <stdio.h>
#include<stdlib.h>
struct
{
float f;
int i;
char c;
}s;
union
{
float f;
int i;
char c;
}u;
int main()
{
printf("memory allocate by structure=%d",sizeof(s));
printf("\n memory allocate by union=%d",sizeof(u));
system("pause");
return 0;
}
#include <stdio.h>
#include<stdlib.h>
struct
{
float f;
int i;
char c;
}s;
union
{
float f;
int i;
char c;
}u;
int main()
{
printf("memory allocate by structure=%d",sizeof(s));
printf("\n memory allocate by union=%d",sizeof(u));
system("pause");
return 0;
}
No comments:
Post a Comment