Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Please read this: https://docs.codewars.com/training/troubleshooting#post-discourse
help with this is become frustating
#include <stdlib.h>
int getIndex( const int arr[], int el, size_t n);
int *array_diff(const int *arr1, size_t n1, const int *arr2, size_t n2, size_t *z) {
if(n1 == 0){
return 0;
}else {
int tmp[] = {0};
int index = 0;
for (size_t t=0;t<n1;t++){
tmp[t] = arr1[t];
}
}
}
int getIndex( const int arr[], int el, size_t n){
int h = -1;
for (size_t i=0;i<n;i++){
if (arr[i] == el){
h = i;
break;
}
}
if (h != -1){
return h;
}
else return -1;
}
#include <stdlib.h>
int getIndex( const int arr[], int el, size_t n);
int *array_diff(const int *arr1, size_t n1, const int *arr2, size_t n2, size_t *z) {
if(n1 == 0){
return 0;
}else {
int tmp[] = {0};
int index = 0;
for (size_t t=0;t<n1;t++){
tmp[t] = arr1[t];
}
}
}
int getIndex( const int arr[], int el, size_t n){
int h = -1;
for (size_t i=0;i<n;i++){
if (arr[i] == el){
h = i;
break;
}
}
if (h != -1){
return h;
}
else return -1;
}
help with this, is become frustating.
With a declaration of
int *array_diff
you will need to return a dynamically allocated array as opposed to one only local to the scope of the function. To make the expectations more clear, I have added some comments to the solution set-up, one of which refers to setting*z
as the array length as opposed toz
. Usemalloc
to define your return, and the test suite willfree
the memory.I'm new here and beginner too, I've done the same function in python and javascript but in c language problem with variable types :(
Please, mark your post as having spoiler content next time, also, check how to use markdown formatting when posting code here, there is a link in the post below.
thank you founded
This comment is hidden because it contains spoiler information about the solution
None
to the caller (https://docs.codewars.com/training/troubleshooting#expected-the-same)This comment is hidden because it contains spoiler information about the solution