Hello, Q: 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. In addition, declare a array named emp of 30 of these structures. 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 kth element of emp (assume k has been declared as an integer variable and assigned a value in the range of the array elements). ========== My program however has errors, I would be grateful if you could correct them. ALSO, would your solution be like mine or do you have another way to do this? Thanks. MY PROGRAM: #include struct Emp { double d; char *str; int arr[11]; }; int main(void) { emp[30]; emp[29].arr[10] = 12; emp[0].d = 3.5; emp[k].str="Hello"; return 0; }

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter13: Structures
Section: Chapter Questions
Problem 3PP
icon
Related questions
Question

Hello,
Q:
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. In addition, declare a array named emp of 30 of these structures. 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 kth element of emp (assume k has been declared as an integer variable and assigned a value in the range of the array elements).
==========
My program however has errors, I would be grateful if you could correct them. ALSO, would your solution be like mine or do you have another way to do this? Thanks.

MY PROGRAM:
#include<stdio.h>
struct Emp
{
double d;
char *str;
int arr[11];
};
int main(void)
{
emp[30];
emp[29].arr[10] = 12;
emp[0].d = 3.5;
emp[k].str="Hello";
return 0;
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Graphical User Interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning