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
Which apparatus is likely to carry a ladder? (There may be more than one answer.)
Aloiza [94]
B and D
hope this helped
4 0
2 years ago
I NEED HELP HERE SUM POINTS ( i will report if you put a link and or no answer
Y_Kistochka [10]

Answer:

ok I will help you ha Ha ha ha ha ha ha ha ha ha ha ha

8 0
2 years ago
To increase the thermal efficiency of a reversible power cycle operating between thermal reservoirs at TH and Tc, would you incr
alukav5142 [94]

<u></u>\ T_{c} has greater effect.

<u>Explanation</u>:

\eta_{\max }=1-\frac{T_{c}}{T_{A}}

T_{c}\\ = Temperature of cold reservoir

T_{H} = Temperature of hot reservoir

when T_{c} is decreased by 't',

$\eta_{\text {incre }}$ = 1-\frac{\left(\tau_{c}-t\right)}{T_{H}}

=n \ + \frac{t}{T_{n}}      -(i)

when {T_{H}} is increased by 'T'

\eta_{i n c}=\frac{n+\frac{t}{T_{H}}}{\left(1+\frac{k}{T_{H}}\right)}-(ii)

\eta_{\text {incre }} \ T_{c}>\eta_{\text {incre }} T_{\text {H }}

7 0
3 years ago
A fluid of density 900 kg/m3 passes through a converging section of an upstream diameter of 50 mm and a downstream diameter of 2
NISA [10]

Answer:

Q= 4.6 × 10⁻³ m³/s

actual velocity will be equal to 8.39 m/s

Explanation:

density of fluid = 900 kg/m³

d₁ = 0.025 m

d₂ = 0.05 m

Δ P = -40 k N/m²

C v = 0.89

using energy equation

\dfrac{P_1}{\gamma}+\dfrac{v_1^2}{2g} = \dfrac{P_2}{\gamma}+\dfrac{v_2^2}{2g}\\\dfrac{P_1-P_2}{\gamma}=\dfrac{v_2^2-v_1^2}{2g}\\\dfrac{-40\times 10^3\times 2}{900}=v_2^2-v_1^2

under ideal condition v₁² = 0

v₂² = 88.88

v₂ = 9.43 m/s

hence discharge at downstream will be

Q = Av

Q = \dfrac{\pi}{4}d_1^2 \times v

Q = \dfrac{\pi}{4}0.025^2 \times 9.43

Q= 4.6 × 10⁻³ m³/s

we know that

C_v =\dfrac{actual\ velocity}{theoretical\ velocity }\\0.89 =\dfrac{actual\ velocity}{9.43}\\actual\ velocity = 8.39m/s

hence , actual velocity will be equal to 8.39 m/s

6 0
3 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:
  • What parts does the block contain?
    5·2 answers
  • Colonial Adventure Tours calculates the total price of a trip by adding the trip price plus other fees and multiplying the resul
    9·1 answer
  • Compact fluorescent bulbs are much more efficient at producing light than are ordinary incandescent bulbs. They initially cost m
    11·1 answer
  • Discuss four (4) advantages of direct and indirect water supply system.
    5·2 answers
  • In the ______ phase of the organizational life cycle, the organization is usually very small and agile, focusing on new products
    8·1 answer
  • Question 3 (5 points)
    7·1 answer
  • Método de Programación lineal utilizado para resolver problemas en teoría de redes?
    15·1 answer
  • 30 points have a good day
    11·1 answer
  • What do you think of web 3.0? do you think it will be realized someday in the future?​
    5·1 answer
  • Does anyone know what this is​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!