im having some trouble with pointers in linux (redhat 8.0 with gcc). i can run this code fine in windows but it just wont work right in linux

Code:
#include <stdio.h>

int main() {
    char temp[20] = "testing";  
    char temp2[20] = {'\0'};
    int spot = 2;
    
    copy(temp, temp2, &spot, 5);
    printf("%s\n", temp2);
    
    return 0;
}

int copy(char *src, char *dest, int *start, int end) {
    int x = 0;
    
    --*start;
    while(*start < end) {
        dest[x] = src[*start];
        
        ++*start;
        ++x;
    }
    
    return 0;
}
copy is just supposed to take a source a dest and some posistion info. it take the start and end and changes dest to be the middle(of start and end).

sorry about asking for help on this same dam function but i just dont get it!!!