c语言用宏定义常量
As we know that, while declaring an array we need to pass maximum number of elements, for example, if you want to declare an array for 10 elements. You need to pass 10 while declaring. Example: int arr[10];
众所周知,在声明数组时,例如,如果要声明一个包含10个元素的数组,则需要传递最大数量的元素。 您需要在声明时通过10 。 示例: int arr [10];
But, there is a good way, to define a constant by using Macro for it, so that we can easily edit, when required.
但是,有一种很好的方法,可以使用宏为其定义常量,以便我们可以在需要时轻松进行编辑。
Macro definition:
宏定义:
#define MAX 10
Example:
例:
#include <stdio.h>
#define MAX 10
int main()
{
int