Solution: incompatible implicit declaration of built-in function ‘bzero’

While using the bzero() function you may have run into the message warning: incompatible implicit declaration of built-in function ‘bzero’.

The solution for this common, annoying, message is straightforward. Simply include the header file <string.h> and the warning will go away!

#include <string.h>

What is bzero?

bzero() is a function in C and C++ programming languages, commonly used in systems programming, including in many parts of the Linux kernel and utilities. It sets the first n bytes of the area starting at the address pointed to by s (its first argument) to zero (bytes containing ‘\0’).

Please note, bzero() has been deprecated in favor of memset(), as memset() is more standard across different systems and has a more intuitive name. For instance, to set 100 bytes of memory starting at pointer s to zero, you would use:

memset(s, 0, 100);
See also  How to install Ruby 1.8.7 on CentOS 5.5 Linux

Leave a Comment