Short Q/A Input and Output Handling - Students Free Notes

Why do we use the return 0 statement in the main function of a C program?

∅In C, the main function is the entry point of the program. The return 0; statement at the end of the main function indicates successful program execution. In C, the main function returns an integer value, and by convention, returning 0 signifies that the program executed successfully without errors. Non-zero return values can be used … Read more

What is the difference between an integer and a floating-point number in C?

In C, integers and floating-point numbers are both used to store numerical data, but they differ in the type of numbers they can represent. An integer is a data type used to store whole numbers, both positive and negative, without any fractional part (e.g., -1, 0, 100). The int data type in C is typically … Read more

Differentiate between printf() and scanf() functions.

printf() is used to display output to the screen, whereas scanf() is used to take input from the user. printf() formats and outputs data, while scanf() reads and stores data from the user into variables.Example: int num; scanf(“%d”, &num); // User input is stored in ‘num’ printf(“You entered: %d”, num); // Output the value of … Read more