To emit a message, the user space C developer will often use the trusty printf(3) glibc API (or perhaps the cout when writing C++ code). However, it's important to understand that in kernel space, there are no libraries. Hence, we simply do not have access to the good old printf() API. Instead, it has essentially been re-implemented within the kernel as the printk() kernel API (curious as to where its code is? its here within the kernel source tree: kernel/printk/printk.c:printk()).
Emitting a message via the printk() API is simple and very much similar to doing so with printf(3). In our simple kernel module, here's where the action occurs:
printk(KERN_INFO "Hello, world\n");
Though very similar to printf at first glance, printk is really quite different. In terms of similarities, the API receives a format string as its parameter. The format string is pretty much identical to that of printf.
But...