I have set the buffer to size 100. I display the buffer in the main function where the buffer is declared. However, when I pass the buffer to the function and get the sizeof
You are using the size of the pointer to the buffer (4 bytes), rather than the size of the buffer.
In C, you have to pass the size of the buffer separately, which is part of the reason buffer overruns happen so easily and frequently.
void load_buffer(char * buffer, size_t bufSize) { ... }