You want a function which takes two arrays a and b which are both of the same length n and determines if they are "reversals" of each other. return 1 if a is the reverse of b (and vice-versa) return 0 otherwise. examples: (1, 3, 3, 4) is the reverse of {4, 3, 3, 1} (9, 8, 2, 2, 1, 9) is the reverse of (9, 1, 2, 2, 8, 9) Your job: write the function! Skeleton given below. int rev_eq(int a[], int b[], int n) {
You want a function which takes two arrays a and b which are both of the same length n and determines if they are "reversals" of each other. return 1 if a is the reverse of b (and vice-versa) return 0 otherwise. examples: (1, 3, 3, 4) is the reverse of {4, 3, 3, 1} (9, 8, 2, 2, 1, 9) is the reverse of (9, 1, 2, 2, 8, 9) Your job: write the function! Skeleton given below. int rev_eq(int a[], int b[], int n) {
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Please the code must be in c program
![## Question 5
You want a function which takes two arrays `a` and `b` which are both of the same length `n` and determines if they are "reversals" of each other.
- Return 1 if `a` is the reverse of `b` (and vice-versa).
- Return 0 otherwise.
**Examples:**
- `{1, 3, 3, 4}` is the reverse of `{4, 3, 3, 1}`
- `{9, 8, 2, 2, 1, 9}` is the reverse of `{9, 1, 2, 2, 8, 9}`
**Your job:** Write the function! Skeleton given below:
```c
int rev_eq(int a[], int b[], int n) {
}
```
**Instructions:**
Implement the function `rev_eq` to check if the array `a` is the reverse of array `b`.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fac6c0457-7a45-43f2-b38c-64ac65853ed3%2F69f3bafe-54c9-455c-9af0-9b570694bd15%2F34gz32_processed.jpeg&w=3840&q=75)
Transcribed Image Text:## Question 5
You want a function which takes two arrays `a` and `b` which are both of the same length `n` and determines if they are "reversals" of each other.
- Return 1 if `a` is the reverse of `b` (and vice-versa).
- Return 0 otherwise.
**Examples:**
- `{1, 3, 3, 4}` is the reverse of `{4, 3, 3, 1}`
- `{9, 8, 2, 2, 1, 9}` is the reverse of `{9, 1, 2, 2, 8, 9}`
**Your job:** Write the function! Skeleton given below:
```c
int rev_eq(int a[], int b[], int n) {
}
```
**Instructions:**
Implement the function `rev_eq` to check if the array `a` is the reverse of array `b`.
Expert Solution

Step 1 Code
int rev_eq(int a[], int b[], int n){
// iteration for n times
for(int i=0; i<n; i++){
// check if ith index of array a from starting is not equal
// ith index of array b from last
if(a[i]!=b[n-i-1]){
// if not equal.. means array is not reverse. return 0
return 0;
}
}
// if array a is revese equivalent to array b. return 1
return 1;
}
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

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

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