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
madam [21]
3 years ago
13

When a variable is stored in memory, it is associated with an address. To obtain the address of a variable, the & operator c

an be used. For example, &a gets the memory address of variable a. Let's try some examples.
Write a C program addressOfScalar.c by inserting the code below in the main function.

Questions:
1) Run the Cprogram, attach a screenshot of the output in the answer sheet.
2) Attach the source code in the answer sheet
3) Then explain why the address after intvar is incremented by 4 bytes instead of 1 byte.
Engineering
1 answer:
liubo4ka [24]3 years ago
3 0

Answer:

Explanation:

1) C program file addressOfScalar.c

#include <stdio.h>

int main()

{

//intialize a char variable, print its address and the next address

char charvar = 'a';

printf("address of charvar = %p\n", (void *)(&charvar));

printf("address of charvar - 1 = %p\n", (void *)(&charvar - 1));

printf("address of charvar + 1 = %p\n", (void *)(&charvar + 1));

//intialize a int variable, print its address and the next address

int intvar = 1;

printf("address of intvar = %p\n", (void *)(&intvar));

printf("address of intvar - 1 = %p\n", (void *)(&intvar - 1));

printf("address of intvar + 1 = %p\n", (void *)(&intvar + 1));

}

In C programming language, an int variable takes 4 bytes of memory. So any arithmetic on integer address, always considers it as 4 bytes of data. So intvar-1 refers to a location 4 bytes before intvar's address and intvar+1 refers to 4 bytes after intvar's address.

You might be interested in
Find Re,Rc,R1 and R2!? Show your work.(hlp plz)
Brums [2.3K]
Can u be more clear with the question plsss?
3 0
3 years ago
What do you do when two parts of a transfer line move at different rates?
Tatiana [17]

Answer:Buffer

Explanation:

4 0
3 years ago
(TCO 1) Name one disadvantage of fixed-configuration switches over modular switches. a. Ease of management b. Port security b. F
frutty [35]

Answer:

The answer is A.

Explanation:

Two main types of network switches, modular and fixed configuration switches, are used for connecting the devices with one another provided they are on the same network.

As the name suggests, modular switches can be configured according to your needs and specific situations where you need a different setup.

The one advantage fixed-configuration switches have over the modular switches is that they are easier to operate. You can't change anything for a different application but they are simpler to setup and use, you can just plug them in and start using. They are usually for the more casual end-user and home networks etc.

I hope this answer helps.

5 0
3 years ago
Calculate the thermal efficiency (ηth) for the actual cycle using pump efficiency (ηpump) = 0.85. You’ll need to find the high-p
dangina [55]

Answer:

Thermal efficiency(ηth) = 1 - (TH/Tc), where TH is temperature of hot reservoir and Tc is temperature of cold reservoir.

ηth = 1 - (300/Tc)

We can assume a value for TH to be 400°C

Then,

ηth = 1 - (300/400) = 1 - 0.75 = 0.25

Explanation:

Thermal efficiency, ηth, of an heat engine is define as the ratio of the work it does, W, to the heat input at the high temperature, QH.

The thermal efficiency is expressed mathematically as:

ηth= QH/W

OR

Thermal efficiency(ηth) = 1 - (TH/Tc).

In other words, the fraction of heat that is converted to work is the thermal efficiency. That is, the measure of performance of engines that uses heat energy in their operation. It has no dimension.

Examples of such engines are:

Steam turbine;

Any internal combustion engine;

A refrigerator.

In operation of a refrigeration or heat pumps, thermal efficiency indicates the extent to which the energy added by work is converted to net heat output. Since it is dimensionless number, we must always express W, QH, and QC in the same units

8 0
3 years ago
Read 2 more answers
Lawn maintenance is an alternative energy source<br> -true<br> -false
Reika [66]

Answer:

false

Explanation:

4 0
3 years ago
Other questions:
  • 100 points Im so bored lol
    11·2 answers
  • (I'm bored and have points to blow so here is a riddle. Don't try to look it up, I made it up just now.)
    14·2 answers
  • Consider a very long, cylindrical fin. The temperature of the fin at the tip and base are 25 °C and 50 °C, respectively. The dia
    11·1 answer
  • Which option would be the best way to communicate the product idea in the following scenario?
    12·1 answer
  • A 90-hp (shaft output) electric car is powered by an electric motor mounted in the engine compartment. If the motor has an avera
    8·1 answer
  • Which organism breaks down dead and dying waste in an ecosystem
    6·1 answer
  • What does 3CuCI2 mean
    11·1 answer
  • EverFi future smart pie chart
    11·1 answer
  • How can we love our country? Not by words but by deeds. - Jose P. Laurel
    7·1 answer
  • How far away must a pwc stay from anyone being towed behind another vessel?.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!