Current location - Trademark Inquiry Complete Network - Tian Tian Fund - What is the function of braces after if in C language?
What is the function of braces after if in C language?
The writing is correct. Parentheses indicate that this is a complete statement block, and when else conditions are met, the statements in the statement block are executed in order; Without parentheses, only the first sentence after else will be executed.

Then the if statement ends, and the last two sentences no longer belong to the if statement, so that no matter what deta is equal to, x2 = (-b-sqrt (DETA))/2 * a; And printf ("the calculation result is x 1=%f x2=%f", x 1, x2); Will be implemented.

Extended data:

ANSI C provides standard c language library functions.

C language beginners prefer Turbo C? 2.0 provides more than 400 runtime functions, each of which performs a specific function and can be called by users at will. These functions are generally divided into input and output functions, mathematical functions, string and memory functions, functions related to BIOS and DOS, character screen and graphics functions, process control functions, directory functions and so on.

Windows SDK provided by Windows system contains thousands of functions related to Windows application development. Other operating systems, such as Linux, also provide a large number of functions for developers to call.

As a programmer, you should be familiar with the functions of the target platform library functions as much as possible. Only in this way can we easily develop applications on specific platforms. For example, as a developer of Windows applications, you should be familiar with the Windows SDK as much as possible; As a Linux application developer, you should be familiar with Linux system calls and POSIX function specifications as much as possible. ?

Baidu encyclopedia -c language