Macros in C - Recommendation for defining a macro in C language



 recommendation for defining a macro inc language

Learn C - C tutorial - recommendation for defining a macro inc language - C examples - C programs

Recommendation for defining a macro in C language

  • A macro is a fragment of code.
  • Object-like macros similar data objects when used, function-like macros resemble function calls.
  • You might define any valid identifier as a macro, even if it is a C keyword.
 recommendation for defining a macro inc language

Learn C - C tutorial - Recommendation for defining a macro inc language - C examples - C programs

Sample Code

#include <stdio.h>
#define MAX_TRY 10
#define CITY "new delhi"
int main()
{
    printf("Value of MAX_TRY: %d\n",MAX_TRY);
    printf("Value of CITY: %s\n",CITY);
    return 0;
}

Output

Value of MAX_TRY: 10
Value of CITY: new delhi


View More Quick Examples


Related Searches to Macros in C - Recommendation for defining a macro in C language