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
Ayo, how do I change my username on here?
nydimaria [60]

Answer:

I'm not sure

Explanation:

eeeeeeeeeeeeeeeeeeeeeee

4 0
4 years ago
Radioactive wastes are temporarily stored in a spherical container, the center of which is buried a distance of 10 m below the e
a_sh-v [17]

Answer:

Outside temperature =88.03°C

Explanation:

Conductivity of air-soil from standard table

   K=0.60 W/m-k

To find temperature we need to balance energy

Heat generation=Heat dissipation

Now find the value

We know that for sphere

q=\dfrac{2\pi DK}{1-\dfrac{D}{4H}}(T_1-T_2)

Given that q=500 W

so

500=\dfrac{2\pi 2\times .6}{1-\dfrac{2}{4\times 10}}(T_1-25)

By solving that equation we get

T_2=88.03°C

So outside temperature =88.03°C

6 0
3 years ago
What is the least count of screw gauge?<br> (a) 0.01 cm<br> (b) 0.001 cm<br> (c) 0.1 cm<br> (d) 1 mm
Nonamiya [84]
Its 0.001

0.01 x100 = 1mm
0.001x100=0.1mm
0.1=10mm
1m
3 0
3 years ago
All of these are uses of microwaves except...
Talja [164]

Answer:D

Explanation:

5 0
3 years ago
An unknown immiscible liquid seeps into the bottom of an open oil tank. Some measurements indicate that the depth of the unknown
barxatty [35]

Answer:

The specific weight of unknown liquid is found to be 15 KN/m³

Explanation:

The total pressure in tank is measured to be 65 KPa in the tank. But, the total pressure will be equal to the sum of pressures due to both oil and unknown liquid.

Total Pressure = Pressure of oil + Pressure of unknown liquid

65 KPa = (Specific Weight of oil)(depth of oil) + (Specific Weight of unknown liquid)(depth of unknown liquid)

65 KN/m² = (8.5 KN/m³)(5 m) + (Specific Weight of Unknown Liquid)(1.5 m)

(Specific Weight of Unknown Liquid)(1.5 m) = 65 KN/m² - 42.5 KN/m²

(Specific Weight of Unknown Liquid) = (22.5 KN/m²)/1.5 m

<u>Specific Weight of Unknown Liquid = 15 KN/m³</u>  

4 0
3 years ago
Other questions:
  • Answer this question fast
    8·1 answer
  • A 10-ft-long simply supported laminated wood beam consists of eight 1.5-in. by 6-in. planks glued together to form a section 6 i
    5·1 answer
  • The town of Mustang, TX is concerned that waste heat discharged from a new up- stream power plant will decimate the minnow popul
    10·1 answer
  • A Si sample contains 1016 cm-3 In acceptor atoms and a certain number of shallow donors, the In acceptor level is 0.16 eV above
    5·2 answers
  • A beam spans 40 feet and carries a uniformly distributed dead load equal to 2.2 klf (not including beam self-weight) and a live
    15·1 answer
  • Please help with my economics problem
    8·1 answer
  • Tech A says that LED brake lights illuminate faster than incandescent bulbs. Tech B says that LED brake lights have
    13·1 answer
  • 50 points
    7·1 answer
  • Why is personal development necessary based activity success life and career​
    11·1 answer
  • which type of irrigation fluid is typically used for endoscopic procedures using monopolar electrosurgery
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!