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
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.
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...
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...
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 +...
Given a class: public class Money { int wholeNumber; int decimalPart; boolean positive; char currencySymbol; }...
Given a class: public class Money { int wholeNumber; int decimalPart; boolean positive; char currencySymbol; } Write a constructor for setting the 4 instance variables (in the order specified above). The constructor must validate the input throwing an IllegalArgumentException (you can specify any error message you see fit) if any of the following conditions are not met: either the int values are negative decimalPart is greater than 99 the currencySymbol is not one of '$', '€', or '£' Write an...
Given: (T • W) • [(T ⋁ E) ⋁ (W • E)] Which of the following...
Given: (T • W) • [(T ⋁ E) ⋁ (W • E)] Which of the following can be derived from the given statement using only a single application of commutativity? Check all that apply. 1)(W • T) • [(T ⋁ E) ⋁ (W • E)] 2)(T • W) • [(W • E) ⋁ (T ⋁ E)] 3)~(T • W) ⋁ ~[(T ⋁ E) ⋁ (W • E)] 4)[(T ⋁ E) ⋁ (W • E)] • (T • W) 5)(T •...
Here is a bit of Java code: Thing t = new Thing(); t.method( (int i)-> i...
Here is a bit of Java code: Thing t = new Thing(); t.method( (int i)-> i + 1 ); Here is a skeleton for class Thing: class Thing { public interface Mystery { ????? } public void method( Mystery param ) { // body of method omitted } } Which text below would work where ????? is given above: a) void method( int i ); b) int method( int i ); c) abstract int method( int i ); d) abstract...
The power supplied by a torque t to rotate an object to angular frequency w is...
The power supplied by a torque t to rotate an object to angular frequency w is p=tw. A common car engine produces t=300 Nm at w=3000 RPM (rotations per minute). Suppose you want to create an electric car that runs on battery and electric motor. Typically, electric car motors utilize a current of 100A and have a cros sectional area of 0.5 m2. Suppose also that the number of wire turns in the coil of the motor is N=100. Q1....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT