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 type of current that flows from the electrode across the arc to the work is called what?
Scrat [10]

Answer:

Direct current.

Explanation:

5 0
3 years ago
8. What is the purpose of the 300 Log?
Gnom [1K]

Answer:

“An OSHA 300 log is where companies record the injuries that occur at the workplace,” said Luna. “By law, they have to report all the injuries to OSHA.” The OSHA law gives workers and their unions the right to have access to injury logs.

4 0
2 years ago
The fan blades suddenly experience an angular acceleration of 2 rad/s2. If the blades are rotating with an initial angular veloc
madreJ [45]

Answer:

Option B

116 ft/s^{2}

Explanation:

\theta=2 rev=2(2\pi)=4\pi

\alpha \theta=0.5(\omega_f^{2}-\omega_i^{2})

\alpha (4\pi)= 0.5(\omega_f^{2}-\omega_i^{2})

\alpha (8\pi)= (\omega_f^{2}-\omega_i^{2})

(2) (8\pi)= (\omega_f^{2}-\omega_i^{2})

(2) (8\pi)= (\omega_f^{2}-4^{2})

\omega_f=8.14 rads/s

v=r\omega=1.75*8.14=14.245 ft/s

Centripetal acceleration =\omega_f^{2} r=8.14^{2}*1.75=115.95 ft/s^{2}

Tangential component=dr=2*1.75=3.5

Resultant=\sqrt{3.5^{2}+115.95^{2}}\approx 116 ft/s^{2}

5 0
3 years ago
Define the Problem
gtnhenbr [62]

Answer:

rbrnrifnfnrfbdjrbfbfjrn

4 0
3 years ago
I need solution for this question please ​
AlladinOne [14]

Answer:

a true b false thos is the solution

6 0
3 years ago
Read 2 more answers
Other questions:
  • Calculate the impedance of a 20 mH inductor at a frequency of 100 radians/s. Calculate the impedance of a 500 µF inductor at a f
    9·2 answers
  • The natural variation of a process relative to the variation allowed by the design specifications is known as
    15·1 answer
  • Rain falls on a 1346 acre urban watershed at an intensity of 1.75 in/hr for a duration of 1 hour. The catchment land use is 20%
    10·1 answer
  • Dunno what to ask, okbye
    5·1 answer
  • What are the different branches of engineering involved in manufacturing a general-purpose elevator?
    6·1 answer
  • A car air-conditioning unit has a 0.5-kg aluminum storage cylinder that is sealed with a valve, and itcontains 2 L of refrigeran
    5·1 answer
  • Which of the following statements is not true about underage drinking?
    10·1 answer
  • An ocean thermal energy conversion system is being proposed for electric power generation. Such a system is based on the standar
    5·1 answer
  • The driver should be able to see the ground within _____ to the front?
    14·1 answer
  • The ______ number of a flow is defined as the ratio of the speed of flow to the speed of sound in the flowing fluid.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!