Malloc has no idea what you want the memory for. It simply allots you the number of bytes that you asked for. You can memset that same number of bytes. You may also use calloc, which initializes the bytes to zero.