1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Phantasy [73]
3 years ago
13

Given the code segment below, complete the assignments as stated in the comments. struct aaa { int m; int nn; } struct bbb{ stru

ct aaa myfield; int sum; } struct bbb myvar; // write one statement to place the integer value 44 into the field sum of structure variable myvar . // write one statement to place the integer value -17 into the field nn of structure variable myvar .
Computers and Technology
1 answer:
grin007 [14]3 years ago
6 0

Answer:

  1. using namespace std;
  2. struct aaa {
  3.    int m;
  4.    int nn;
  5. };
  6. struct bbb{
  7.    struct aaa myfield;
  8.    int sum;  
  9. };
  10. struct bbb myvar;
  11. int main()
  12. {
  13.    myvar.sum =44;
  14.    myvar.myfield.nn = -17;
  15.    
  16.    cout<<myvar.sum<<"\n";
  17.    cout<<myvar.myfield.nn<<"\n";
  18.    return 0;
  19. }

Explanation:

Given two data structures (Line 2-9), we can set the value of 44 to field of sum structure variable myvar by using a dot syntax

                      myvar.sum = 44

To assign value to field of nn of structure in myvar, we need to access the myfield of myvar and then followed by nn. Hence, the statement shall be

                     myvar.myfield.nn = -17

In short the we can always use the dot syntax the access the value of an inner field of a particular data structure.

You might be interested in
You locate a web page that includes "edu" in the address, along with other words and symbols. the page is simple—a plain backgro
stich3 [128]
No, just because it is an edu address doesn't mean it is a good source. Avoid websites with minimal content or effort to the page they are most likely fake. <span />
7 0
4 years ago
Which of the following are the differences between DDR3 SDRAM and DDR2 SDRAM? DDR3 transfers data at twice the rate of DDR2. DDR
Free_Kalibri [48]

Answer:

DDR3 SDRAM having twice rate of data transferring as compared to DDR2 SDRAM both have 240 pin connection. DDR3 memory power consumption is 40 % less as compared to DDR2. both are transfers data on a 64 data bits wide bus. The physical difference occur in both type a cut is present at bottom along pin in DDR2 it is occur probably in center and In DDR3 it is occur at left  through center.

7 0
3 years ago
What does it mean to have 2 warnings on brainly and what if i get another one?
steposvetlana [31]
By giving wrong answers or cheating I guess
5 0
3 years ago
Read 2 more answers
Role playing games have an objective of trying to gain the most points in a certain period of time.
VashaNatasha [74]

Answer: I think False.

8 0
2 years ago
Read 2 more answers
Please use thread to complete the following program: one process opens a file data.txt, then creates a thread my_thread. The job
Firlakuza [10]

Answer:

Here is the code:-

//include the required header files

#include<stdio.h>

#include<pthread.h>

// method protocol definition

void *count_lines(void *arg);

int main()

{

    // Create a thread handler

    pthread_t my_thread;

    // Create a file handler

    FILE *fh;

    // declare the variable

    int *linecnt;

    // open the data file

    fh=fopen("data.txt","r");

// Create a thread using pthread_create; pass fh to my_thread;

    pthread_create(&my_thread, NULL, count_lines, (void*)fh);

    //Use pthread_join to terminate the thread my_thread

    pthread_join( my_thread, (void**)&linecnt );

    // print the number of lines

printf("\nNumber of lines in the given file: %d \n\n", linecnt);

    return (0);

}

// Method to count the number of lines

void *count_lines(void *arg)

{

    // variable declaration and initialization

    int linecnt=-1;

    char TTline[1600];

    //code to count the number of lines

    while(!feof(arg))

    {

         fgets(TTline,1600,arg);

         linecnt++;

    }

    pthread_exit((void *)linecnt);

    // close the file handler

    fclose(arg);

}

Explanation:

Program:-

8 0
3 years ago
Other questions:
  • What is requirement analysis
    8·1 answer
  • The ability to keep web page visitors at your site is called _______.
    11·1 answer
  • The best-known communications protocol is probably smtp, which regulates internet data transport. _________________________
    6·1 answer
  • Which data type requires the greatest number of bytes in computer memory? A. character B. integer C. single-precision number D.
    14·1 answer
  • Convert the following Base 2 (binary) numbers to base 10(decimal):<br> 11101<br> 1010101
    13·1 answer
  • Matlab In this assignment you will write a function that will calculate parallel resistance for up to 10 parallel resistors. Cal
    15·1 answer
  • Write the definition of a class WeatherForecast that provides the following behavior (methods): A method called set_skies that h
    13·1 answer
  • 1.printer is an example of......... device.<br><br>​
    11·2 answers
  • 6. Assume there are three small caches, each consisting of four one-word blocks. One cache is fully associative, a second is two
    5·1 answer
  • Which of the following tools helps ensure your document will open in older versions of word
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!