C Pointer Program to get the last name from a full name
C Language Flag / Logo Another C programming here, this article will simply explain how to do char array operation in C language to get the last word from a whole sentence, or in this case we just rename our function to be more specific to get a person last name from its full name. This is a very simple C function to get a user last name from a user full name. This function will do some pointer operation, so if you are trying to learn about pointer in C, this may help you little bit on understanding about a pointer in C: char * get_last_name(char * full_name) { char *last_name = full_name; int last_space=0; for(int i=0; i 0) last_space+=1; last_name += last_space; return last_name; } This function will loop through all the characters bit by bit and will try to find any spaces located on that character. If a space is found, then store the last space pointer location and return that pointer as its function return. - We define our function called get_last_name to