[Solved] how to this error in C : incompatible type for argument 1 of ‘printf’


I have not used C in a few months, but I should be able to help you out regardless. Unlike languages like Python, in C, it is important to specify what data format you are trying to print. Adding the term "%f" to your print statement will tell your compiler that you intend to print out a float value. Here is what the syntax could look like:

#include <stdio.h>
#include <stdlib.h>

static float w = 10.00;
int main()
{
    printf("%f", w);
    return 0;
}

For more information on printing values in C, I recommend that you check out out the following resources:

As I mentioned above, I have not been programming in C recently. Thus my suggestions may not be 100% optimal. Regardless, they should help you get started on your C journey!

1

solved how to this error in C : incompatible type for argument 1 of ‘printf’