Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
- Finish the swap function below using pointers and write the call to swap in the reverse function using the address of the array positions array[i] and array[size-i-1].using pointers.
- DON'T FORGET TO DECLARE THE PARAMETERS in the function. (Hint: if you can't figure it out with pointers, do it with the references
#include <iostream>
using namespace std;
// Function to swap two ints using pointers
// @param pointer to an int
// @param pointer to an int
void swap( ) {
// TODO: Add code that swaps two integers using pointers
}
// Function to reverse array
void reverse(int a[], int size)
{
for (int i = 0; i < size/2; i++) {
// TODO: write the call to swap in the reverse function using the
// address of the array positions array[i] and array[size-i-1].
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 nowThis is a popular solution!
Step by stepSolved in 2 steps
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.Similar questions
- 9. Write function getMoveRow to do the following a. Return type integer b. Parameter list i. 1-d character array (i.e. move), size 3 c. Convert the row portion of the player’s move to the associated integer index for the board array d. Example: i. move = ‘b2’ ii. 2 is the row iii. 2 is index 1 in the board array e. Return the row array index that corresponds to the player’s move f. Return a -1 if the row is not valid (i.e. INVALID) 10. Write function getMoveCol to do the following a. Return type integer b. Parameter list i. 1-d character array (i.e. move), size 3 c. Convert the column portion of the player’s move to the associated integer index for the board array d. Example: i. move = ‘b2’ ii. b is the column iii. b is index 1 in the board array e. Return the column array index that corresponds to the player’s move f. Return a -1 if the column is not valid (i.e. INVALID) I am getting an error when entering the code at the very end. please fix it. This is the code in C int…arrow_forwardAnswer in C++ code please! (Duplicate Elimination with vector) Use a vector to solve the following problem. Read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read, validate it and store it in the vector only if it isn't a duplicate of a number already read. After reading all the values, display only the unique values that the user entered. Begin with an empty vector and use its push_back function to add each unique value to the vector.arrow_forward13. Write function updateBoard to do the following a. Return type void b. Parameter list i. 1-d character array (i.e. move), size 3 ii. 2-d character array (i.e. board), size 8 rows and 8 cols iii. Structure Player (i.e. player) as a pointer c. Declare local variable rowInt, data type integer, set equal to function call getMoveRow, passing parameter move as an argument d. Declare local variable colInt, data type integer, set equal to function call getMoveCol, passing parameter move as an argument e. If calling function checkHorizontal (i.e. see argument list in step f.i.) is greater than ZERO, call function updateHorizontal, passing as arguments i. rowInt ii. colInt iii. board iv. player f. If calling function checkVertical (i.e. see argument list in step f.ii.) is greater than ZERO, call function updateVertical, passing as arguments i. rowInt ii. colInt iii. board iv. player g. If calling function checkDiagonal (i.e. see argument list in step f.iii.) is greater than ZERO, call…arrow_forward
- Complete the function below. You must not change the fuction signatures, names return types and parametersmust remain as given. Please the code must be in c+arrow_forwardYour 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…arrow_forwardin c++arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education