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 cantilever beam is 4000 mm long span and has a u.d.l. of 0.30 kN/m. The flexural stiffness is 60 MNm². Calculate: 1. Slope 2.
Viefleur [7K]

Answer:

1. Slope = 53.3 x 10⁻⁶

2. Deflection = -0.00016m

Explanation:

given:

let L = 4 m (span of cantilever beam)

let w = 300 N/m (distributed load)

let EI =60 MNm² (flexural stiffness)

                 dy      w * L³        300 x 4³

1. slope = ------- = --------- =  ------------------- =  53.3 x 10⁻⁶

                  dx        6EI           6 x 60x10⁶

                                  wL⁴               300 x 4⁴

2. Deflection = y = - ----------- =  - ------------------ =   -0.00016m

                                    8EI                8 x 60x10⁶

therefore the deflection is 0.16mm downwards.

3 0
3 years ago
In a black box experiment, when the amount of material exiting a closed system is less than the amount of material entering the
Oksi-84 [34.3K]

When the material that exits is lesser in amount than that of the entering material in a black box experiment, the parts of the system need to be changed.

<h3>What happens in a black box experiment?</h3>

In a black box experiment, the experimenters need to make assumptions regarding the drawing of conclusions. One such conclusion is the amount of material that exits.

If such amount is lesser than the one that enters the system, such experiment concludes that it is the time to change the parts of the system.

Hence, option D holds true regarding the black box experiment.

Learn more about black box experiment here:

brainly.com/question/13403296

#SPJ1

4 0
2 years ago
What is 12 cm theodolite​
Klio2033 [76]

Answer:

Answer below :)

Explanation:

<u>SIZE OF THEODOLITE:</u> A theodolite is designated by diameter of the graduated circle on the lower plate. The common sizes are 8 cm to 12 cm while<em> 14 cm</em> to <em>25 cm</em> instrument are used for triangulation work.

4 0
3 years ago
Read 2 more answers
Solve using Matlab the problems:
Firlakuza [10]

Answer:

Explanation:

% Clears variables and screen

clear; clc

% Asks user for input

n = input('Total number of objects: ');

r = input('Size of subgroup: ');

% Computes and displays permutation according to basic formulas

p = 1;

for i = n - r + 1 : n

   p = p*i;

end

str1 = [num2str(p) ' permutations'];

disp(str1)

% Computes and displays combinations according to basic formulas

str2 = [num2str(p/factorial(r)) ' combinations'];

disp(str2)

=================================================================================

Example: check

How many permutations and combinations can be made of the 15 alphabets, taking four at a time?

The answer is:

32760 permutations

1365 combinations

==================================================================================

7 0
3 years ago
What is 90 to the power of 46
Mnenie [13.5K]

Answer:Just multiply 90 by itself 46 times

Explanation:

do it

6 0
4 years ago
Other questions:
  • 3. Suppose that a class named Bicycle contains a private nonstatic integer named height, a public nonstatic String named model,
    10·1 answer
  • Asap asap plz help maxium points
    6·2 answers
  • You are out of gas in the desert and you accidently dropped your phone battery down an Abandoned oil well. You have a charged ca
    14·1 answer
  • The following program includes fictional sets of the top 10 male and female baby names for the current year. Write a program tha
    9·2 answers
  • If you owned a business, what are some of the ways you could follow green computing recommendations with regards to recycling an
    13·1 answer
  • Emergency plans are being formulated so that rapid action can be taken in the event of an equipment failure. It is predicted tha
    12·2 answers
  • Find the mechanical average of a wheel axle System of the wheel has a radius of 1.5 feet in the accident has a radius of 6 inche
    6·1 answer
  • The tool life decreases from 0.8 min to 0.2 min due to the increase in cutting speed from 60 m/min to 120 m/min in a turning ope
    12·1 answer
  • Choose the correct word or phrase to complete the sentence to explain human intervention in a machine system.
    13·1 answer
  • Pls follow me in brainly​
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!