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
The design specifications of a 1.2-m long solid circular transmission shaft require that the angle of twist of the shaft not exc
Verizon [17]

Answer:

c = 18.0569 mm

Explanation:

Strategy  

We will find required diameter based on angle of twist and based on shearing stress. The larger value will govern.  

Given Data  

Applied Torque

T = 750 N.m

Length of shaft

L = 1.2 m

Modulus of Rigidity

G = 77.2 GPa

Allowable Stress

г = 90 MPa

Maximum Angle of twist  

∅=4°

∅=4*\pi/180

∅=69.813 *10^-3 rad

Required Diameter based on angle of twist  

∅=TL/GJ

∅=TL/G*\pi/2*c^4

∅=2TL/G*\pi*c^4

c=\sqrt[4]{2TL/\pi G }∅

c=18.0869 *10^-3 rad

Required Diameter based on shearing stress

г = T/J*c

г = [T/(J*\pi/2*c^4)]*c

г =[2T/(J*\pi*c^4)]*c

c=17.441*10^-3 rad

Minimum Radius Required  

We will use larger of the two values  

c= 18.0569 x 10^-3 m  

c = 18.0569 mm  

3 0
3 years ago
A closed, rigid tank is lled with a gas modeled as an ideal gas, initially at 27°C and a gage pressure of 300 kPa. The gas is he
sergejj [24]

Answer:

T₂ =93.77  °C

Explanation:

Initial temperature ,T₁ =27°C= 273 +27 = 300 K

We know that

Absolute pressure = Gauge pressure + Atmospheric pressure

Initial pressure ,P₁ = 300+1=301 kPa

Final pressure  ,P₂= 367+1 = 368  kPa

Lets take  temperature=T₂

We know that ,If the volume of the gas is constant ,then we can say that

\dfrac{P_2}{P_1}=\dfrac{T_2}{T_1}

{T_2}=T_1\times \dfrac{P_2}{P_1}

Now by putting the values in the above equation we get

{T_2}=300\times \dfrac{368}{301}\ K

The temperature in  °C

T₂ = 366.77 - 273  °C

T₂ =93.77  °C

8 0
3 years ago
Advantages of using metal
Contact [7]

Answer:

Metals have high melting points thus unlikely to degrade when temperatures increase, they can be fabricated and are cost effective due to availability.

Explanation:

Aluminum is the most abundant in the Earth's crust with good thermal and electric properties. It is soft, malleable ,ductile and lighter making it a vital metal in construction industry. An alloy of copper and tin, bronze is a better connector of heat and electricity ,commonly used in automobile industry for bearings and springs production. Steel a carbon alloy has applications in forging and automotive.

4 0
2 years ago
If i eat myself will I get twice as big or disappear completely?
Butoxors [25]
Disappear completely
5 0
2 years ago
Why do wires hang loosely during summer?
Stella [2.4K]

Answer:

due to the expansion process and they contract during winter due to the contraction process. Explanation: Electric cables are the solids which exhibit the property of contraction and expansion.

6 0
2 years ago
Other questions:
  • Methane and oxygen react in the presence of a catalyst to form formaldehyde. In a parallel reaction, methane is oxidized to carb
    12·1 answer
  • A tank contains 350 liters of fluid in which 50 grams of salt is dissolved. Pure water is then pumped into the tank at a rate of
    8·1 answer
  • Hi, I have an assignment in which i needs to write a report on (Rationalization of electrical energy consumption) and i need cha
    6·1 answer
  • Required information NOTE: This is a multi-part question. Once an answer is submitted, you will be unable to return to this part
    9·1 answer
  • Water is pumped from one large reservoir to another at a higher elevation. If the flow rate is 2.5 ft3 /s and the pump delivers
    12·1 answer
  • Can someone Please help me..? If I'm your Onii-San then answer. And get brainliest. Make sure to explain why..
    15·1 answer
  • An intelligence signal is amplified by a 65% efficient amplifier before being combined with a 250W carrier to generate an AM sig
    5·1 answer
  • The difference between an initial condition and a boundary condition for conduction in a solid is:___________
    9·1 answer
  • Most equipment is cooled by bringing cold air in the front and ducting the heat out of the back. What is the term for where the
    9·1 answer
  • 1. Band saw lower wheel does not require a guard *
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!