Solved: 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  Linux 'find' to list files less than or greater than a certain size
Photo of author
As Editor in Chief of HeatWare.net, Sood draws on over 20 years in Software Engineering to offer helpful tutorials and tips for MySQL, PostgreSQL, PHP, and everyday OS issues. Backed by hands-on work and real code examples, Sood breaks down Windows, macOS, and Linux so both beginners and power-users can learn valuable insights.

Leave a Comment