Page 105 - C-Language
P. 105
It is easy to get confused in the C preprocessor, and treat it as part of C itself, but that is a mistake
because the preprocessor is just a text substitution mechanism. For example, if you write
/* WRONG */
#define MAX 100;
int arr[MAX];
the code expands to
int arr[100;];
which is a syntax error. The remedy is to remove the semicolon from the #define line. It is almost
invariably a mistake to end a #define with a semicolon.
Multi-line comments cannot be nested
In C, multi-line comments, /* and */, do not nest.
If you annotate a block of code or function using this style of comment:
/*
* max(): Finds the largest integer in an array and returns it.
* If the array length is less than 1, the result is undefined.
* arr: The array of integers to search.
* num: The number of integers in arr.
*/
int max(int arr[], int num)
{
int max = arr[0];
for (int i = 0; i < num; i++)
if (arr[i] > max)
max = arr[i];
return max;
}
You will not be able to comment it out easily:
//Trying to comment out the block...
/*
/*
* max(): Finds the largest integer in an array and returns it.
* If the array length is less than 1, the result is undefined.
* arr: The array of integers to search.
* num: The number of integers in arr.
*/
int max(int arr[], int num)
{
int max = arr[0];
for (int i = 0; i < num; i++)
if (arr[i] > max)
max = arr[i];
return max;
}
https://riptutorial.com/ 81

