Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const char *const test_string = "test string";
- const size_t test_string_length = strlen(test_string) + 1;
- const size_t arr_size = 16;
- char mallocated = malloc(arr_size + sizeof(char));
- if(test_string_length <= arr_size){
- memcpy(mallocated, test_string, test_string_length);
- printf("Copied with offset = %s\n", mallocated + 5); // <------- Here
- } else {
- fprintf(stderr, "The string %s is too long\n", test_string);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement