Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdbool.h>
- #define DIM 5
- int * sort(int array[])
- {
- for(int i = 0; i < DIM; i ++)
- {
- for(int j = 0; j < DIM - 1; j ++)
- {
- if(array[i] < array[j])
- {
- int temp = array[i];
- array[i] = array[j];
- array[j] = temp;
- }
- }
- }
- return array;
- }
- bool areEqual(int array1[], int array2[])
- {
- for(int i = 0; i < DIM; i ++)
- {
- if(array1[i] != array2[i])
- {
- return false;
- }
- }
- return true;
- }
- int main()
- {
- int array1[DIM] = {1,2,12,4,12};
- int array2[DIM] = {13,4,12,2,1};
- if(areEqual(sort(array1), sort(array2)))
- {
- printf("I due array sono uguali");
- }
- else
- {
- printf("I due array non sono uguali");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement