#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
const char *last_name(const char *full_name) | |
{ | |
return strrchr(full_name, ' ') + 1; | |
} | |
int main() { | |
const char *buffer = strcpy(malloc(80), "Harry Potter"); | |
const char *res = last_name(buffer); | |
free(buffer); | |
printf("%s\n", res); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment