Your Question: Objective Create a program that will initialize an array, initialize a pointer to that array, and output the contents and address of the array in various ways. Create a call-by-reference function to modify a variable that's been declared in the main() function by passing the variable's address to the function. How to create, output, and dereference a pointer. How to use a dereferenced pointer to change the value of a variable. Instructions Create a program named LastnameFirstname13.c, that does the following: Note: This program has no user input. Declare and initialize an integer array of size 5. Initialize each element with a value other than 0. Declare and initialize an integer pointer that points to the address of the integer array above. Declare and initialize an integer variable. Use an initial value other than 0. Later in the program, this variable will be used in a call-by-reference function that modifies the value without returning a value. Output the last element in the array in the following four ways: Using array subscript notation with the array name Using pointer/offset notation with the array name Using array subscript notation with the pointer Using pointer/offset notation with the pointer Output the contents of the array in the following four ways: Using array subscript notation with the array name Using pointer/offset notation with the array name Using array subscript notation with the pointer Using pointer/offset notation with the pointer Output the addresses of each element in the array using array subscript notation with the array name NOTE: The C compiler on UH UNIX has been updated to automatically add the 0x prefix when using the format specifier %p. You do not need to manually type the 0x prefix. Create the following custom function given its prototype and description: Declare the function prototype above main and the function definition below main. void increaseIntViaPointer(int *); A call-by-reference function that will increase the value of the integer that the parameter pointer points to. At the beginning of the function, output a message to tell the user that execution is inside the function and that the parameter is about to be modified by 100. Increase the integer value that the pointer points to by 100. In other words, dereference the parameter pointer and increase the integer value by 100. At the end of the function, output another message to show the new integer value by dereferencing the pointer. Back in the main() function, output a message showing the initial state of the variable before calling the custom function. Call increaseIntViaPointer() and pass in the address of the integer variable that was created at the beginning of the program. Output another message showing the final state of the variable after calling the custom function. Use the Example Output to format your output the same way. All output should be clear in what and how it is being displayed. Be sure to have a program description at the top and in-line comments. Be clear with your comments and output to the user, so I can understand what you're program is doing. attached is an example output
Your Question: Objective Create a program that will initialize an array, initialize a pointer to that array, and output the contents and address of the array in various ways. Create a call-by-reference function to modify a variable that's been declared in the main() function by passing the variable's address to the function. How to create, output, and dereference a pointer. How to use a dereferenced pointer to change the value of a variable. Instructions Create a program named LastnameFirstname13.c, that does the following: Note: This program has no user input. Declare and initialize an integer array of size 5. Initialize each element with a value other than 0. Declare and initialize an integer pointer that points to the address of the integer array above. Declare and initialize an integer variable. Use an initial value other than 0. Later in the program, this variable will be used in a call-by-reference function that modifies the value without returning a value. Output the last element in the array in the following four ways: Using array subscript notation with the array name Using pointer/offset notation with the array name Using array subscript notation with the pointer Using pointer/offset notation with the pointer Output the contents of the array in the following four ways: Using array subscript notation with the array name Using pointer/offset notation with the array name Using array subscript notation with the pointer Using pointer/offset notation with the pointer Output the addresses of each element in the array using array subscript notation with the array name NOTE: The C compiler on UH UNIX has been updated to automatically add the 0x prefix when using the format specifier %p. You do not need to manually type the 0x prefix. Create the following custom function given its prototype and description: Declare the function prototype above main and the function definition below main. void increaseIntViaPointer(int *); A call-by-reference function that will increase the value of the integer that the parameter pointer points to. At the beginning of the function, output a message to tell the user that execution is inside the function and that the parameter is about to be modified by 100. Increase the integer value that the pointer points to by 100. In other words, dereference the parameter pointer and increase the integer value by 100. At the end of the function, output another message to show the new integer value by dereferencing the pointer. Back in the main() function, output a message showing the initial state of the variable before calling the custom function. Call increaseIntViaPointer() and pass in the address of the integer variable that was created at the beginning of the program. Output another message showing the final state of the variable after calling the custom function. Use the Example Output to format your output the same way. All output should be clear in what and how it is being displayed. Be sure to have a program description at the top and in-line comments. Be clear with your comments and output to the user, so I can understand what you're program is doing. attached is an example output
Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 18RQ
Related questions
Question
Your Question:
- Objective
- Create a program that will initialize an array, initialize a pointer to that array, and output the contents and address of the array in various ways.
- Create a call-by-reference function to modify a variable that's been declared in the main() function by passing the variable's address to the function.
- How to create, output, and dereference a pointer.
- How to use a dereferenced pointer to change the value of a variable.
- Instructions
- Create a program named LastnameFirstname13.c, that does the following:
- Note: This program has no user input.
- Declare and initialize an integer array of size 5. Initialize each element with a value other than 0.
- Declare and initialize an integer pointer that points to the address of the integer array above.
- Declare and initialize an integer variable. Use an initial value other than 0.
- Later in the program, this variable will be used in a call-by-reference function that modifies the value without returning a value.
- Output the last element in the array in the following four ways:
- Using array subscript notation with the array name
- Using pointer/offset notation with the array name
- Using array subscript notation with the pointer
- Using pointer/offset notation with the pointer
- Output the contents of the array in the following four ways:
- Using array subscript notation with the array name
- Using pointer/offset notation with the array name
- Using array subscript notation with the pointer
- Using pointer/offset notation with the pointer
- Output the addresses of each element in the array using array subscript notation with the array name
- NOTE: The C compiler on UH UNIX has been updated to automatically add the 0x prefix when using the format specifier %p. You do not need to manually type the 0x prefix.
- Create the following custom function given its prototype and description:
Declare the function prototype above main and the function definition below main.- void increaseIntViaPointer(int *);
- A call-by-reference function that will increase the value of the integer that the parameter pointer points to.
- At the beginning of the function, output a message to tell the user that execution is inside the function and that the parameter is about to be modified by 100.
- Increase the integer value that the pointer points to by 100. In other words, dereference the parameter pointer and increase the integer value by 100.
- At the end of the function, output another message to show the new integer value by dereferencing the pointer.
- void increaseIntViaPointer(int *);
- Back in the main() function, output a message showing the initial state of the variable before calling the custom function.
- Call increaseIntViaPointer() and pass in the address of the integer variable that was created at the beginning of the program.
- Output another message showing the final state of the variable after calling the custom function.
- Use the Example Output to format your output the same way.
- All output should be clear in what and how it is being displayed.
- Be sure to have a program description at the top and in-line comments.
- Be clear with your comments and output to the user, so I can understand what you're program is doing.
- Create a program named LastnameFirstname13.c, that does the following:
- attached is an example output
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning