Does strncpy()
leads to memory leak when we're copying less number of data to a larger (compile-time allocated) buffer? In other words, can the under-utilization of memory be termed as memory leak?
Below is my code
#define uk "ln"
int main()
{
char buffer[32];
strncpy(buffer,uk,sizeof(buffer));// IS it memory leak free?
// uk macro has 3 byte of size to
// hold the string but here the
// Attemp of 32 byte is made to copy
// from uk macro to buffer?
}
Is there any memory leak or bug in above code?