i must admit defeat again, i keep getting null when i use this in linux
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]) {
printf("%s\n", ( copy("testing", 2, 5) ) );
return 0;
}
int copy(char data[], int start, int end) {
char value[255];
char tmp[255];
strcpy(tmp, data);
memset( tmp, 8, (start - 1) );
strncpy( value, tmp, ((end - start) + 2) );
value[ ((end - start) + 2) ] = '\0';
return ( atoi(value) );
}
i checked out cplusplus.com/ref/ for how to use atoi, im using it correctly right? it returns the int so i could use it as a return right?