A
last week
Akshaycountry asked

Why do we use a full stop after %d?

Sarthak Baral
Expert
last week
Sarthak Baral answered

Good question! The full stop you see after the %d in the printf statement is used to format the output.

In the code, printf("%d.", paulAge); is printing the value of paulAge followed by a period. So, if paulAge is 18, the output will be 18.

The full stop acts just like any other character, you can add it to make the output clearer or to indicate the end of a statement. This can be useful for formatting your output in a way that makes sense in context.

Hope this helps! Let me know if you have more questions.

C
This question was asked as part of the Learn C Programming course.