Home > front end >  I need to figure out what exactly the function of the % sign in C
I need to figure out what exactly the function of the % sign in C

Time:08-05

when you write code such as printf("Average score: %f\n", (score[0] score[1] score[2]) / 3.0);

what is the point of the %f , is it needed?, i know that sometimes you change the letter after it, what are ways you can use the %?

CodePudding user response:

that's a print formatter. "f" is for floats (decimals). the % is used when you want to put a variable value in a printf statement. So % followed by a letter (f,d,c,s,p, etc) indicates the type.

  •  Tags:  
  • c
  • Related