computer science

posted by .

Declare a structure whose tag name is Emp and that contains these fields (in the following order): a double field named d, a character pointer named str, and an array of eleven integers named arr.

* I'm good till here.


In addition, declare a array named emp of 30 of these structures.

*this has me scratching my head is this Emp emp[30];


Assign the value 12 to the last element of the arr field of the last element of emp. Assign 3.5 to the d field of the first emp element. Assign the string Hello to the k'th element of emp (assume k has been declared as an integer variable and assigned a value in the range of the array elements).

  • computer science -

    Emp emp[30];
    should work.

  • computer science -

    struct Emp
    {
    double d;
    char *str;
    int arr[11];
    }e[30];

    // assigning value 12 to the last element of the arr[11] of the last emp
    e[30].arr[11] = 12;

    // assign 3.5 to the d field of the first emp
    e[0].d = 3.5;

    //assuming k has value
    strcpy(e[k].str,"hello");

  • computer science -

    struct Emp{
    double d;
    char *str;
    int arr[11];
    }emp[30];
    emp[29].arr[10]=12;
    emp[0].d=3.5;
    emp[k].str="Hello";

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. Computers

    Create a class named Checkup with fields that hold a patient number, two blood pressure figures (systolic and diastolic), and two cholesterol figures (LDL and HDL). Include methods to get and set each of the fields. Include a method …
  2. computers

    I need a part order module for parallel array named OrderNums
  3. Chem

    CH3-COOH-CH-COO- 3-hydroxybutyrate or β-hydroxybutyrate I have no idea why this is named what it is named. I know that the COO on the end is the most oxidized. I don't understand why a 3 is being used. Would it not be 4 b/c there …
  4. English

    I have done some extensive research on the various "-nyms", but I am still a bit unsure about the difference between EPONYM and TOPONYM. Am I correct, that an eponym is a person whom a place is named after, and a toponym a place named …
  5. Math

    Four good friends, who love cats, have each named their cat after one of the other friends. Of the clues that follow, only one is true; the others are false. Which friend owns which cat?
  6. math

    Four good friends, who love cats, have each named their cat after one of the other friends. Of the clues that follow, only one is true; the others are false. Which friend owns which cat?
  7. computer science

    Assume that BlogComment is a structured type with these fields, comment (a string, the actual comment), and two int fields: like, dislike which count the number of "likes" and "dislikes" of the comment by visitors. Assume that nComments …
  8. Computers

    Write a statement that assigns the length of an array named strAddressBook to a variable named intAddressCount.
  9. Visual Basic

    Write a statement that assigns the length of an array named strAddressBook to a variable named intAddressCount.
  10. computer science

    A Bagels store charges 75 cents per bagel for orders of less than a half-dozen bagels and 60 cents per bagel for orders of a half-dozen or more. Assume that the number of bagels ordered has been stored in a variable named NumBagels. …

More Similar Questions