Purpose: Understand the pointer in C and know how tomanipulatepointers. Understand how to create a C program; compile and execute it. Description: Write a C program by implementing the following...

1 answer below »


Purpose:



  1. Understand the pointer in C and know how tomanipulatepointers.

  2. Understand how to create a C program; compile and execute it.



Description:


Write a C program by implementing the following instructions:



  1. declare three integervariablesa1, b1, c1

  2. declare three integer pointer variablespa1,pb1,pc1

  3. assign 18 to variablea, 10 to variableb

  4. assign the address ofvariableato variablepa

  5. assignpatopb

  6. assignpatopc

  7. print out the values pointed by
    pa,pb,pc(dereferencing it)

  8. assign the address of variablebtopa

  9. print out the values pointed by
    pa,pb,pc(dereferencing it)


  10. print out the values of
    pa,pb,pc





Note: the format specifier for an address (pointer), you can use%p



What should be submitted:



  1. Run the program and submit asnapshotof successful program execution. (ForWindowsOS, use SnippingToolto take a snapshot.)

  2. Explain the difference between printing outpaand*pa

  3. Add a new statement to print out the value of variablea1, the address of variablea1,the size of variablea1.


  4. A .cfile thatcontains thecomplete source code of theprogram.

Answered Same DayFeb 03, 2021

Answer To: Purpose: Understand the pointer in C and know how tomanipulatepointers. Understand how to create a C...

Neha answered on Feb 04 2021
151 Votes
Running screenshot
Difference between pa and *pa
pa is used to print the address of the variable.
It is known as referencing the variable. This will return the address of the variable. As shown in the example, the address of a1 is assigned in the pa1 and it is printed by using %p format...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here