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
A 800-MW steam power plant, which is cooled by a nearby river, has a thermal efficiency of 40 percent. Determine the rate of hea
Arturiano [62]

Answer:

Rate of heat transfer to river=1200MW

So the actual amount of heat rejected ti the river will be less as there will some heat loss to surrounding and in pipes

Explanation:

In order to find the actual heat transfer rate is lower or higher than its value we will first find the rate of heat transfer to power plant:

Efficiency=\frac{work}{heat transfer to power plant}

Heat transfer=\frac{work}{Efficiency\\} \\\\Heat transfer=\frac{800}{0.40}\\\\Heat transfer=2000MW

From First law of thermodynamics:

Rate of heat transfer to river=heat transfer to power plant-work done

Rate of heat transfer to river=2000-800

Rate of heat transfer to river=1200MW

So the actual amount of heat rejected ti the river will be less as there will some heat loss to surrounding and in pipes.

4 0
3 years ago
A quantity of water within a piston-cylinder assembly executes a Carnot power cycle. During isothermal expansion, the water is h
Harman [31]

Answer:

  Answer with Explanation is in the following attachments.

                     

Explanation:

7 0
3 years ago
Not sure which one....
Airida [17]
I think downwards as that's how most saw's work.
4 0
3 years ago
What advanced safety features are now standard on 2023 Z?
Anettt [7]

The advanced safety features that are now standard on 2023 Z are:

  • Pedestrian Detection and Automatic Emergency Braking
  • Intelligent Forward Collision Warning (IFCW).
  • Blind Spot Alert.

<h3>What is 2023 Z?</h3>

The above is the short name or nickname for the All New 2023 Nissan Z coupe Sports car.

The care also features Advanced driver assist and safety technology which relieves the driver's everyday workload, allowing you to focus on what matters most.

Learn more about safety features in cars:
brainly.com/question/24078882
#SPJ1


3 0
2 years ago
1 pts
kherson [118]
Vibrations felt through the floor are due to unbalanced wheels. It would most likely be rear because if it’s the front the steering whee would also vibrate
3 0
3 years ago
Other questions:
  • ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    9·1 answer
  • Two points along a wire are labeled Xand Y. The current is measured to be iXY= –3A.The reference direction of iXY is defined by
    11·1 answer
  • A strong base (caustic or alkali) is added to oils to test for: b. entrained air a)- alkalinity b)- acidity c)- contamination. d
    11·1 answer
  • B. Is the “Loading Time” of any online application a functional or a non-functional requirement? Can the requirement engineers s
    11·1 answer
  • Can someone pls give me the answer to this?
    14·1 answer
  • A steady state filtration process is used to separate silicon dioxide (sand) from water. The stream to be treated has a flow rat
    5·1 answer
  • If a nurse does not agree to the discipline set due to a complaint made against this nurse, after reviewing the proposed agreed
    14·1 answer
  • True or false for the 4 questions?
    8·1 answer
  • Explain the purpose of wrench plzzz
    5·2 answers
  • 9. What power tool incorporates a set of dies and punches to cut new
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!