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
Julli [10]
3 years 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]3 years 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
There are many opportunities for unscrupulous people to break information system security. Of the five components in an informat
7nadin3 [17]

The answer is letter e.

People is the component poses the very large ongoing security risk. It also can be a threat to the safety. People play an essential part in most operational systems and methods. Information, ability and mental outlook often determine the feature and quantity of system output. Just as a stereo requires the right component, high-performance business systems require the right fit of people to work.


8 0
3 years ago
Read 2 more answers
What is unique address in ICT​
iren2701 [21]

Answer:

IP Addressing.

Explanation:

It stands for Internet Protocol address. It is a unique address that identifies a computer on a network such as the Internet.

Hope this helped you!

4 0
3 years ago
একটা ছবি কতটি কথার সমান?
OlgaM077 [116]

Answer:

একটি ছবির মূল্য 84.1 শব্দের

Explanation:

8 0
3 years ago
What is a bitmap ???
leva [86]
<span>a representation in which each item corresponds to one or more bits of information, especially the information used to control the display of a computer screen.
</span><span>represent (an item) as a bitmap.
</span>
4 0
4 years ago
Read 2 more answers
An academic or professional blog would be especially useful in which of the following fields?
Vesna [10]
Blogs, even academic and professional, are not usually considered reliable sources. Most importantly, that's because they don't undergo the peer review process, which ensures the quality of the published papers (that they don't publish lies, in simple words).

So usually, you would prefer a published paper.

When then would you use a blog?
One such instance is when you want to find out about a quickly changing field , for example the newest standards in software development. So software engineering is one such field.

Another field is internet protection and security, as the viruses and the ways to defend against them also develop faster than can be published in a paper
7 0
3 years ago
Read 2 more answers
Other questions:
  • A(n) ______ notification is a message that initiates from the sending location without a request from the receiver. With a(n) __
    5·2 answers
  • The PRNG variable ___________ is defined in NIST SP 800-90 as a number associated with the amount of work required to break a cr
    7·1 answer
  • Write pseudocode instructions to carry out each of the following computational operations:1. Determine the area of a triangle gi
    12·1 answer
  • You and a few friends are having a meal at a pizza restaurant, and the server has just given you the bill. Write a function that
    14·1 answer
  • PLS HELP IMEDIATELY!!!!!
    15·2 answers
  • What is the difference between a switch and a hub?
    8·1 answer
  • What are 3 important reasons to reconcile bank and credit card accounts at set dates?
    15·1 answer
  • Select the tips you should follow when writing a business report.
    12·1 answer
  • ?__________ is the term that describes devices that automate many industrial tasks by receiving digital commands and converting
    5·1 answer
  • Can i get any information on this website i'd like to know what its for ?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!