Question

union taylormade { struct mizuno *t; struct mizuno *w; int tw; }; struct mizuno { char...

union taylormade {
  struct mizuno *t;
  struct mizuno *w;
  int tw; 
};     

struct mizuno {

char hmmb[2];

int irons[4];

union taylormade t;

};

what is the size in bytes of the struct above?

Homework Answers

Answer #1

The size of the structure is 32 bytes.

Explanation:

The statement by statement explanation of the given source code is given below:

union taylormade
{
struct mizuno *t; // 8 bytes
struct mizuno *w; // 8 bytes
int tw; // 4 bytes
};   

struct mizuno
{
char hmmb[2]; // 2 bytes
int irons[4]; // 16 bytes
union taylormade t;// 8 bytes
};

The C language has a lot of built-in data type and we can create our own data type as well by using:

  • Structure
  • Union

The structure can be used to combine different data types.

The union is a special case of a structure in which different data types are stored at the same memory location. So, for given example, the size of the union is considered as 8 bytes only.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
C Programming Given the declarations: struct STRUCTURE { int aa[7]; double dd; char ff[30]; } union...
C Programming Given the declarations: struct STRUCTURE { int aa[7]; double dd; char ff[30]; } union Group { char bb[7]; int a[7]; } struct STRUCTURE yy; union Group zz; (you may assume that sizeof(char)=1; sizeof(int)=4; sizeof(double)=8; Number of bytes reserved for yy is Number of bytes reserved for zz is
IN C++ struct elementType{      int integer;      float decimal;    char ch; }; struct nodeType{...
IN C++ struct elementType{      int integer;      float decimal;    char ch; }; struct nodeType{    elementType e;    nodeType* link: }; Write a member functions that will find the range of values in a singly linked list. The range is returned to the calling function. PLEASE USE THE STRUCT ABOVE
With the following structures defined: struct monster_struct {       char *name;       int commonality;       int...
With the following structures defined: struct monster_struct {       char *name;       int commonality;       int weight;       struct monster_struct *next; }; typedef struct monster_struct monster; typedef struct monster_list {       monster *head; } Write functions to return the second-most-common monster and the third-lightest monster in the list. Don’t worry about headers. Don’t worry about which way to resolve ties. The list will always have three monsters in it.
Consider the following variable definitions: char a, *b, *c; int d[2], *e; int i, *j; How...
Consider the following variable definitions: char a, *b, *c; int d[2], *e; int i, *j; How many total bytes does this code allocate for variables?  Assume a 32-bit representation for integer and pointer values. a     sizeof(char) b     sizeof(char *) c     sizeof(char *) d    2*sizeof(int) e     sizeof(int *) i     sizeof(int) j     sizeof(int *) Total number of bytes ? What is the output of the following piece of code? (Use the above variable definitions). j = &i; *j = 50;                      /* i = 50 */ e = &d[0]; *e...
Define a union data struct WORD_T for a uint16_t integer so that a value can be...
Define a union data struct WORD_T for a uint16_t integer so that a value can be assigned to a WORD_T integer in three ways: (1) To assign the value to each bit of the integer, (2) To assign the value to each byte of the integer, (3) To assign the value to the integer directly. a) Show the code of defining the union data struct WORD_T. b) Show the code to assign 17 to the WORD_T variable foo. b.1) Assign...
For the following questions, use the definitions of the given structure. struct Date {       int yy,...
For the following questions, use the definitions of the given structure. struct Date {       int yy, mm, dd; }; struct Emp {       char EmpName[25];       float Salary;       struct Date hired; }; struct Dep {       struct Emp manager;       struct Emp worker[25];       float Profits; }; Define a struct Date variable called Date1 and initialize it to February 25, 1957, in the correct format. Define a struct Emp variable called Person1 and initialize it to “Roger”, with a salary of $50,000, who was hired...
3. What will be the value of w after the following section of code executes: int...
3. What will be the value of w after the following section of code executes: int w = 4, q = 3; if (q > 5)       if (w == 7)           w == 3;       else            if (w > 3)               w = 1;            else               w = 0; A.0            B.1              C.2          D.3 4. What will be the value of b after the following section of code executes: int a = 4, b = 0; if (a...
/************************************************************************************* Function Prototypes *************************************************************************************/ int ScanArray(char *fname, int myArray[], int nSize); void Ge
/************************************************************************************* Function Prototypes *************************************************************************************/ int ScanArray(char *fname, int myArray[], int nSize); void GenerateFromArray(void); /************************************************************************************/ /************************************************************************************/ int main(void) { /* This is the main() program. It should call the functions ScanArray() and GenerateFromArray() */ GenerateFromArray(); system("pause"); return 0; } /*************************************************************************************** Define this function to scan the elements of an array from the given data file "ArrayInp.dat". If the input file is not found, or contains invalid data, the function should return a 0 and print an error message. If the input...
IN MIPS ASSEMBLY Macro File: Create macros to print an int, print a char, print a...
IN MIPS ASSEMBLY Macro File: Create macros to print an int, print a char, print a string, get a string from the user, open file, close file, read file, and allocate heap memory. You can use more macros than these if you like. Main Program File: Allocate 1024 bytes of dynamic memory and save the pointer to the area. The main program is a loop in which you ask the user for a filename. If they enter nothing for the...
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 extern char **environ;    5 void output(char *a[], char...
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 extern char **environ;    5 void output(char *a[], char *b[]) { 6 int c = atoi(a[0]); 7 for (int i = 0; i < c && b[i]; ++i) { 8 printf("%s", b[i]+2); 9 } 10 } 11 12 void main(int argc, char *argv[]) { 13      14 switch (argc) { 15 case 1: 16 for (int i = 0; environ[i]; ++i) {    17 printf("%s\n", environ[i]); 18 } 19 break; 20 default: 21 output(argv +...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT