answer.
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
Julli [10]
1 year ago
14

When this program is compiled and executed on an x86-64 Linux system, it prints the string 0x48\n and terminates normally, even

though function p2 never initializes variable main. Can you explain this?
Computers and Technology
1 answer:
Alexxandr [17]1 year ago
5 0

Answer:

I get 0x55 and this the linking address of the main function.

use this function to see changes:

/* bar6.c */

#include <stdio.h>

char main1;

void p2()

{

printf("0x%X\n", main1);

}

Output is probably 0x0

you can use your original bar6.c with updaated foo.c

char main;

int main() // error because main is already declared

{

  p2();

   //printf("Main address is 0x%x\n",main);

  return 0;

}

Will give u an error

again

int main()

{

  char ch = main;

  p2(); //some value

  printf("Main address is 0x%x\n",main); //some 8 digit number not what printed in p2()

  printf("Char value is 0x%x\n",ch); //last two digit of previous line output

  return 0;

}

So the pain in P2() gets the linking address of the main function and it is different from address of the function main.

Now char main (uninitialized) in another compilation unit fools the compiler by memory-mapping a function pointer on a char directly, without any conversion: that's undefined behavior. Try char main=12; you'll get a multiply defined symbol main...

Explanation:

You might be interested in
The height of a small rocket y can be calculated as a function of time after blastoff with the following piecewise function: y 5
SOVA2 [1]

Answer:

High level Language

understand

Explanation:

rocket is 0...4433456u888

5 0
1 year ago
You buy a $3,500 car and finance it through the car dealer. the contract says if you are two months delinquent with your payment
photoshop1234 [79]
The car owner acquired his car because the car dealer offers him a financing credit services. It is part of the contract that the car owner should pay in monthly basis. It is a fact and part of the contract also that once the car owner failed to pay 2 months of his contribution, the car dealer will get his car back.
6 0
2 years ago
Which element of the word program window contains buttons for saving a document and for undoing, redoing, and repeating a change
miskamm [114]
The answer is the Quick Access Toolbar. However, it is not only for saving files or undoing your work. Containing a set of commands that are independent, this toolbar is actually customizable wherein you could change these icons to the ones you really need and frequently use. By tweaking the settings, you can even add commands to the Quick Access Toolbar that are not in the ribbon (like New, Open and Print).
7 0
2 years ago
List at least six things you would check for if you were asked to evaluate the workspace of an employee for ergonomics
Evgen [1.6K]

Assessing the risk that surrounds stationary work of employees spending hours at their stations is essential. Below is a list of fundamental ergonomic principles that help identify ergonomic risk factors.


<span>1.       </span>Are the employees maintained in a neutral posture?

<span>2.       </span>Does the stationery allow for movement and stretching?

<span>3.       </span>Is there adequate lighting?

<span>4.       </span>Are chairs adequately adjustable?

<span>5.       </span>Are there appropriate foot rest?

<span>6.       </span>Is there extra storage for better desk organization?






0 0
2 years ago
The groups_per_user function receives a dictionary, which contains group names with the list of users. Users can belong to multi
Akimi4 [234]

The groups_per_user function receives a dictionary, which contains group names with the list of users.

Explanation:

The blanks to return a dictionary with the users as keys and a list of their groups as values is shown below :

def groups_per_user(group_dictionary):

   user_groups = {}

   # Go through group_dictionary

   for group,users in group_dictionary.items():

       # Now go through the users in the group

       for user in users:

       # Now add the group to the the list of

         # groups for this user, creating the entry

         # in the dictionary if necessary

         user_groups[user] = user_groups.get(user,[]) + [group]

   return(user_groups)

print(groups_per_user({"local": ["admin", "userA"],

       "public":  ["admin", "userB"],

       "administrator": ["admin"] }))

3 0
2 years ago
Other questions:
  • The term drive app is used to describe applications stored on a computer true or false
    11·2 answers
  • Which item is essential to know before sketching a navigation menu flowchart? template specifics, such as horizontal or vertical
    12·1 answer
  • Create a division formula.
    9·1 answer
  • Budget Analysis (use while loop) Write a program that asks the user to enter the amount that he or she has budgeted for a month.
    5·1 answer
  • Danielle, a help desk technician, receives a call from a client. In a panic, he explains that he was using the Internet to resea
    9·1 answer
  • Your project must satisfy the following requirements:
    7·1 answer
  • Write a loop that continually asks the user what pets the user has, until the user enters "rock", in which case the loop ends. I
    12·1 answer
  • Select the correct navigational path to freeze the top row of your worksheet. Select the panes you wish to freeze. Click the tab
    15·2 answers
  • Cardinality ratios often dictate the detailed design of a database. The cardinality ratio depends on the real-world meaning of t
    8·1 answer
  • Which characteristic of Cloud computing allows data centers to better manage hard drive failures and allocate computing resource
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!