int main ()
/* local variable definition */
int a = 100;
/* check the boolean condition /
if( a < 20 )
/ if condition is true then print the following /
printf(“a is less than 20\n” );
/ if condition is false then print the following */
printf(“a is not less than 20\n” );
printf(“value of a is : %d\n”, a);
im really struggling to understand %d and how its used could someone please explain please thank you
You mean "sprintf" - Arduino doesn't have "printf".
"%d" simply means print the decimal value of the supplied parameter, in this case the value of the variable "a".
Please remember to use code tags.
im really struggling to understand %d
%d is a format specifier. It says that the variable is to be treated as an int, and output accordingly. Format specifiers can get a lot more complicated, and can add leading spaces, zeros, signs, etc. as well as control width (never less than n characters, for instance).
and how its used
It's only used in calls to functions that expect format specifiers, like printf().
hay thank you i now understand now