Question: QUES) Write code in C, which meets the following requirements. Requirements 1. Create a new file called identical.c, containing a single function that matches this

QUES) Write code in C, which meets the following requirements.

QUES) Write code in C, which meets the following requirements. Requirements 1.

Requirements 1. Create a new file called identical.c, containing a single function that matches this declaration int identical( int al, int b, unsigned int len); 2. Arrays a and b are both of length len, and contain arbitrary integer values 3. The function identical() should return 1 iff arrays a and b contain the same values in the same order, or 0 otherwise 4. len can have any unsigned int value, including O 5. If len is 0 then identical() should return 1 (since the arrays have the same empty - contents) 6. You must not change the contents of the arrays Examples of arrays for which identical should return 1 . a-(10.15,20). b=(10,15,20} a 100), b 100) .a 5,2,2,3,4,5,5), b (5,2,2,3,4,5,5) Examples of arrays for which identical should return 0 .a 1,1, b 1,2) .a 10,15,20), b 10,15,21) .a 11,2,3,4,5), b (5,3,4,2,2) Example of a program that uses your function I. #include 2. // declaration of function implemented in identical.c 3. int identical( int a, int b[, unsigned int len) 5. int main( void ) 7. int a[3] {10, 15, 20); = 8. int b[3] 110, 20, 15 10. if( identical a, b, 31) 12. 13. elsef 14. 15. 16 17 18. 1 printf( "a and b are identical " printf "a and b are NOT identicalln"i return 0; Note the curly-brace syntax for initializing arrays. This only works when you first declare the array. The items listed between curly braces must be constant values

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!