Created
August 8, 2022 10:28
-
-
Save viraatmaurya/bd2ea2dbb859653d5f90e6a5e9763c68 to your computer and use it in GitHub Desktop.
slice() function to slice character from word and return new sliced word in C language.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void *slice(void *, int); /*prototype*/ | |
void *slice(void __restricted *ptr, const int size) | |
{ | |
char* newPtr = (char*)malloc(size); | |
memcpy(newPtr, ptr, size); | |
return newPtr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment