Home
21.
What is the difference between a statement and a block?

A block is a group of statements enclosed in braces ({}). A block can be used in most places that a statement can be used.

22.
What is the one component that must be present in every C program?

The main() function.

23.
What is machine language?

Machine language is made up of digital or binary instructions that the computer can understand. Because the computer can't understand C source code, a compiler translates source code to machine code, also called object code.

24.
What is a function?

A function is an independent section of program code that performs a certain task and has been assigned a name. By using a function's name, a program can execute the code in the function.

25.
C offers two types of functions. What are they, and how are they different?

A user-defined function is created by the programmer. A library function is supplied with the C compiler.

26.
What is an include file?

An include file is a separate disk file that contains information needed by the compiler to use various functions.

27.
long int variables hold bigger numbers, so why not always use them instead of int variables?

A long int variable takes up more RAM than the smaller int. In smaller programs, this doesn't pose a problem. As programs get bigger, however, you should try to be efficient with the memory you use.

28.
What happens if I assign a number with a decimal to an integer?

You can assign a number with a decimal to an int variable. If you're using a constant variable, your compiler probably will give you a warning. The value assigned will have the decimal portion truncated. For example, if you assign 3.14 to an integer variable called pi, pi will only contain 3. The .14 will be chopped off and thrown away.

29.
What happens if I put a number into a type that isn't big enough to hold it?

Many compilers will allow this without signaling any errors. The number is wrapped to fit and therefore won't be correct. For example, if you assign 32768 to a two-byte signed variable of type short, the variable would really contain the value -32768. If you assign the value 65535 to this variable, it really contains the value - 1. Subtracting the maximum value that the field will hold generally gives you the value that will be stored.

30.
What happens if I put a negative number into an unsigned variable?

As the preceding answer indicated, your compiler might not signal any errors if you do this. The compiler does the same wrapping as if you assigned a number that was too big. For instance, if you assign -1 to an unsigned int variable that is two bytes long, the compiler will put the highest number possible in the variable (65535).