Working on some pointer related things in C.I'm wondering what the third line is doing?
char *return_pointer;
static char string_buffer[MAX_WORD_SIZE];
return_pointer = &string_buffer[sizeof(string_buffer)-1];
*return_pointer = '\0';
Working on some pointer related things in C.I'm wondering what the third line is doing?
char *return_pointer;
static char string_buffer[MAX_WORD_SIZE];
return_pointer = &string_buffer[sizeof(string_buffer)-1];
*return_pointer = '\0';
The statement
return_pointer = &string_buffer[sizeof(string_buffer)-1];
is assigning the address of last element of string_buffer
to return_pointer
.
The statement
*return_pointer = '\0';
is simply terminating the string_buffer
with null character.