Why is an escape sequence used? Explain with examples.

An escape sequence is used to represent special characters that cannot be typed directly, such as newline, tab, or quotes. For example, \n represents a newline, \t represents a tab space, and \” represents a double quote. Example: printf(“Hello\nWorld”); This will print “Hello” on one line and “World” on the next. Related Questions: Why is … Read more

Why is a format specifier used? Explain with examples.

A format specifier is used to specify the type of data that should be displayed or processed when using input/output functions like printf() and scanf(). It ensures proper formatting of values. For example, %d is used for integers, %f for floating-point numbers, and %s for strings. Example: int num = 10; printf(“The number is %d”, … Read more