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
Scheduling can best be defined as the process used to determine:​
shutvik [7]

Answer:

Overall project duration

Explanation:

Scheduling can best be defined as the process used to determine a overall project duration.

8 0
3 years ago
What is the measurement below?
Bess [88]

Explanation:

इसिसिसिसैस्स्स्स्स्स्स्स्स्स्सूस्सोस्स्स्स्स्स

8 0
3 years ago
Question text
lisabon 2012 [21]

Answer:

That's a really nice question sadly I don't know the answer I'm replying to you cuz I'm tryna get points so... Sorry

3 0
4 years ago
Let S = { p q |p, q are prime numbers greater than 0} and E = {0, −2, 2, −4, 4, −6, 6, · · · } be the set of even integers. . Pr
Finger [1]

Answer:

prove that | S | = | E | ; every element of S there is an Image on E , while not every element on E has an image on S

Explanation:

Given that S = { p q |p, q are prime numbers greater than 0}

                    E = {0, −2, 2, −4, 4, −6, 6, · · · }

To prove  by constructing a bijection from S to E

detailed  solution attached below

After the bijection :

<em>prove that | S | = | E |</em> :  every element of S there is an Image on E , while not every element on E has an image on S

∴ we can say sets E and S are infinite sets

7 0
3 years ago
If the slotted arm rotates counterclockwise with a constant angular velocity of thetadot = 2rad/s, determine the magnitudes of t
astraxan [27]

Answer:

Magnitude of velocity=10.67 m/s

Magnitude of acceleration=24.62 ft/s^{2}

Explanation:

The solution of the problem is given in the attachments

3 0
3 years ago
Other questions:
  • The displacement volume of an internal combustion engine is 2.2 liters. The processes within each cylinder of the engine are mod
    13·1 answer
  • Are engineers needed in today’s society ? Why or why not ? I need a short three paragraph essay !!! Please help me !!!
    13·1 answer
  • Please select the word from the list that best fits the definition I love horses and want to be a veterinarian
    12·2 answers
  • A Geostationary satellite has an 8kW RF transmission pointed at the earth. How much force does that induce on the spacecraft? (N
    15·1 answer
  • What are the characteristic features of stress corrosion cracks?
    15·1 answer
  • A column carries 5400 pounds of load and is supported on a spread footing. The footing rests on coarse sand. Design the smallest
    10·1 answer
  • John has an exhaust leak in his Acura Integra GS-R, What steps would he take to fix the leak in time for his inspection?
    8·1 answer
  • Pay attention to the following questions!
    14·1 answer
  • Drivers education :Anything that draws your mind off driving is
    9·1 answer
  • Find the differential and evaluate for the given x and dx: y=sin2xx,x=π,dx=0.25
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!