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
Daniel [21]
3 years ago
5

(50 points) Write a program arrays1.cthat checks if two integer arrays are different by one and only one elementwhen compared el

ement by element (first element with first element, second with second, and so on)and displays theelements that are different. The program asks the user to enter the size of the arrays and then the elements of the arrays.
Computers and Technology
1 answer:
Pachacha [2.7K]3 years ago
7 0

Answer:

#include<stdio.h>

int one_element_different(int *a1 ,int *a2 ,int n ,int *element1 ,int *element2) { for (int k=0;k<n;k++) {

if(*a1!=*a2)

return k;

else { a1++; a2++; } }

return 0;

} int main() {

int n;

printf("Enter the length of the array \n");

scanf("%d",&n); int a1[n],a2[n];  

printf("Enter the elements of first array");

for (int i=0;i<n;i++) {

scanf("%d",&a1[i]);

}

printf("\nEnter the elements of second array ");

for (int j=0;j<n;j++)

{

scanf("%d",&a2[j]);

}

int result = one_element_different( a1 ,a2 ,n ,a1 ,a2);

if(result) {

printf("\nArray are Different by one element at %d %d \n ", a1[result], a2[result]);

}

else {

printf("\nArray are NOT Different by one element \n");

}

}

Explanation:

  • Compare each element and if there is any mismatch, return the position of that element otherwise return 0.
  • Get the size from user.
  • If the result has True value, display the message that array are different by one element.
You might be interested in
When replacing a thermostat or water pump, coolant drained from the cooling system should be ________.
Alchen [17]

Answer:

Explanation:

Disposed of in a contained way/recycled.

5 0
2 years ago
Character positions in<br> arrays start counting with<br> the number 1.<br> True<br> False
d1i1m1o1n [39]

Answer:

False.

Explanation:

A data dictionary can be defined as a centralized collection of information on a specific data such as attributes, names, fields and definitions that are being used in a computer database system.

In a data dictionary, data elements are combined into records, which are meaningful combinations of data elements that are included in data flows or retained in data stores.

This ultimately implies that, a data dictionary found in a computer database system typically contains the records about all the data elements (objects) such as data relationships with other elements, ownership, type, size, primary keys etc. This records are stored and communicated to other data when required or needed.

In Computer programming, an array can be defined as data structure which comprises of a fixed-size collection of variables each typically holding a piece of data and belonging to the same data type such as strings or integers.

This ultimately implies that, when a programmer wishes to store a group of related data (elements) of the same type, he or she should use an array.

Generally, character positions in arrays start counting with the number 0 not 1.

Hence, an array uses a zero-based indexing and as such the numbering or position of the characters (elements) starts from number 0. Thus, the first character (element) in an array occupies position zero (0), the second number one (1), the third number two (2) and so on.

6 0
2 years ago
Add me on fornite buddies Lynn_.25
Anna007 [38]

i- why would u ask that

Explanation:

6 0
2 years ago
Read 2 more answers
Practicing touch typing allows you to create documents efficiently and accurately.
Marysya12 [62]
I think the answer to this would be true
8 0
2 years ago
You have a Mobile Legends account???<br>Can I play with You???​
yulyashka [42]

Answer:

yes oo you want to play with me

7 0
2 years ago
Other questions:
  • In this problem we consider sending real-time voice from Host A to Host B over a packet-switched network (VoIP). Host A converts
    12·1 answer
  • Double clicking a word selects the entire word?
    9·2 answers
  • What type of network is capable of delivering voice, video streams, text, and graphics between many different types of devices o
    15·1 answer
  • Presentation graphics programs contain an assortment of tools and operations for creating and editing slides, including preforma
    8·2 answers
  • Adam's interview with the hiring manager is going well. However, he wants to ensure that his skills and work history are memorab
    6·1 answer
  • Int a = 1; int b = 0; int c = -1; if ((b + 1) == a) { b++; c += b; } if (c == a) { a--; b = 4; }
    7·1 answer
  • The advancement in speed of transportation is attributed to invention of this device
    8·1 answer
  • A person's oral communication skills can give either a positive or negative first impression.
    12·1 answer
  • How would you design an adaptive environment for people who are blind?
    10·1 answer
  • What is an automatic update and when should you use it
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!