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
technician A says that in any circuit, electrical current takes the path of least resistance. technician B says that while this
ArbitrLikvidat [17]

Answer:

  technician A is correct

Explanation:

Technician B has circuit topologies confused. In a series circuit, there is only one path for electrical current to take. In a parallel circuit, the current will divide between paths in proportion to the inverse of their resistance. The least resistance path will have the most current.

Technician A is mostly correct.

3 0
3 years ago
I WILL GIVE 20 POINTS!!
Alex777 [14]

Answer:

Use a resume header

Explanation:

Create a Summary

Research industry, employer keywords

there are some hints okay

5 0
3 years ago
Read 2 more answers
What is the significance of Saint Venant's principle?
nexus9112 [7]

Answer:

While calculating the stresses in a body since we we assume a constant distribution of stress across a cross section if the body is loaded along the centroid of the cross section , this assumption of uniformity is assumed only on the basis of Saint Venant's Principle.

Saint venant principle states that the non uniformity in the stress at the point of application of load is only significant at small distances below the load and depths greater than the width of the loaded material this non uniformity is negligible and hence a uniform stress distribution is a reasonable and correct assumption while solving the body for stresses thus greatly simplifying the analysis.

7 0
3 years ago
Please help me it’s for science I only have a few minutes
7nadin3 [17]

Answer:

Rocks

Explanation:

I am not sure tho bc they are made out of coal and I think coal is a kind of rock

3 0
2 years ago
Read 2 more answers
Compute the number of kilograms of hydrogen that pass per hour through a 5-mm-thick sheet of palladium having an area of 0.20 m^
Nat2105 [25]

Answer:

The answer is "\bold{ 259.2 \times 10^{11} }".

Explanation:

The amount of kilograms, which travel in a thick sheet of hydrogen:

M= -DAt \frac{\Delta C}{ \Delta x} \\\\

D =1.0 \times 10^{8} \ \ \ \frac{m^2}{s} \\\\ A = 0.20 \ m^2\\\\t = 1\ \ h = 3600 \ \   sec \\\\

calculating the value of \Delta C:

\Delta C =C_A -C_B

  = 2.4 - 0.6 \\\\    = 1.8 \ \ \frac{kg}{m^3}

calculating the value of \Delta X:

\Delta x = x_{A} -x_{B}

     = 0 - (5\ mm) \\\\ = - 5 \ \ mm\\\\= - 5 \times 10^{-3} \ m

M = -(1.0 \times 10^{8}  \times 0.20 \times 3600 \times  (\frac{1.8}{-5 \times 10^{-3}})) \\\\

    = -(1.0 \times 10^{8}  \times 720 \times  (\frac{1.8}{-5 \times 10^{-3}})) \\\\= -(1.0 \times 10^{8}  \times \frac{ 1296}{-5 \times 10^{-3}})) \\\\= (1.0 \times 10^{8}  \times 259.2 \times 10^3)) \\\\= 259.2 \times 10^{11} \\\\

3 0
3 years ago
Other questions:
  • What is an Algorithm? *
    5·1 answer
  • In the contemporary approach to control systems, benefits of continuous monitoring include which one of the following? Multiple
    9·1 answer
  • A soil has the following Green-Ampt parameters Effective porosity 0.400 Initial volumetric moisture content-15% Hydraulic Conduc
    6·1 answer
  • A fluid of specific gravity 0.96 flows steadily in a long, vertical 0.71-in.-diameter pipe with an average velocity of 0.90 ft/s
    5·2 answers
  • 4-6. A vertical cylindrical storage vessel is 10 m high and 2 m in diameter. The vessel contains liquid cyclohexane currently at
    7·1 answer
  • A kernel-level thread wishes to acquire a mutex lock declared as global in the process. True or False: the function call used be
    6·1 answer
  • Convert.46 to a percentage
    7·1 answer
  • What are the laws that apply to one vehicle towing another?
    11·1 answer
  • What measurement is the usable area of conduit based on?
    11·1 answer
  • The locations and type of electrical device required on an architectural<br> plan are referred to as
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!