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
Given the circuit at the right in which the following values are used: R1 = 20 kΩ, R2 = 12 kΩ, C = 10 µ F, and ε = 25 V. You clo
agasfer [191]

Answer:

a.) I = 7.8 × 10^-4 A

b.) V(20) = 9.3 × 10^-43 V

Explanation:

Given that the

R1 = 20 kΩ,

R2 = 12 kΩ,

C = 10 µ F, and

ε = 25 V.

R1 and R2 are in series with each other.

Let us first find the equivalent resistance R

R = R1 + R2

R = 20 + 12 = 32 kΩ

At t = 0, V = 25v

From ohms law, V = IR

Make current I the subject of formula

I = V/R

I = 25/32 × 10^3

I = 7.8 × 10^-4 A

b.) The voltage across R1 after a long time can be achieved by using the formula

V(t) = Voe^- (t/RC)

V(t) = 25e^- t/20000 × 10×10^-6

V(t) = 25e^- t/0.2

After a very long time. Let assume t = 20s. Then

V(20) = 25e^- 20/0.2

V(20) = 25e^-100

V(20) = 25 × 3.72 × 10^-44

V(20) = 9.3 × 10^-43 V

8 0
3 years ago
Can the United States defeat Iranian forces
Lostsunrise [7]

Answer:

yes for sure

Explanation:

iran oy has 3000 ballistic missiles but america has thousands of nukes. we can easily outnumber their forces as well. this will be a easy victory for us but will result in massive casualties on both sides

5 0
3 years ago
Read 2 more answers
You can safely place a jack on a floor pan to keep a vehicle steady.
Elis [28]

Answer: Yes

Explanation:

7 0
3 years ago
Read 2 more answers
Why was information revolution different or unique <br>​
Xelga [282]

Answer:

It made information easily accessible and ensured individuals became more vast in subject topics of interest.

Explanation:

Information revolution is different and unique and it came with the advent of computers and the internet. A lot of information is stored there which is too large and complex for the human brain.This helped people to access information without much stress as informations about almost every subject is on the Internet.

Individuals can check the informations up and become more vast in interested topics.

8 0
3 years ago
Suppose the working pressure for a boiler is 10 psig, then what is the corresponding absolute pressure?
yanalaym [24]

Answer:

The corresponding absolute pressure of the boiler is 24.696 pounds per square inch.

Explanation:

From Fluid Mechanics, we remember that absolute pressure (p_{abs}), measured in pounds per square inch, is the sum of the atmospheric pressure and the working pressure (gauge pressure). That is:

p_{abs} = p_{atm}+p_{g} (1)

Where:

p_{atm} - Atmospheric pressure, measured in pounds per square inch.

p_{g} - Working pressured of the boiler (gauge pressure), measured in pounds per square inch.

If we suppose that p_{atm} = 14.696\,psi and p_{g} = 10\,psi, then the absolute pressure is:

p_{abs} = 14.696\,psi+10\,psi

p_{abs} = 24.696\,psi

The corresponding absolute pressure of the boiler is 24.696 pounds per square inch.

8 0
3 years ago
Other questions:
  • If 20 kg of iron, initially at 12 °C, is added to 30 kg of water, initially at 90 °C, what would be the final temperature of the
    6·1 answer
  • 6
    5·1 answer
  • The ventilating fan of the bathroom of a building has a volume flow rate of 32 L/s and runs continuously. If the density of air
    7·1 answer
  • Select four types of engineers who might be involved in the development of a product such as an iPhone.
    6·2 answers
  • Use the method of cylindrical shells to find the volume generated by rotating the region bounded by the given curves about the y
    7·1 answer
  • Stakeholders are people or organizations who do what?
    10·2 answers
  • Air is compressed steadily from 100kPa and 20oC to 1MPa by an adiabatic compressor. If the mass flow rate of the air is 1kg/s an
    12·1 answer
  • The build up of electrons will cause electrical called ?
    14·1 answer
  • Determine the slopes and deflections at points B and C for the beam shown below by the moment-area method. E=constant=70Gpa I=50
    10·1 answer
  • A coil consists of 200 turns of copper wire and have a cross-sectional area of 0.8 mmm square.The mean length per turn is 80 cm
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!