“#ifdef in c” Code-Antworten

c Ifdef

//INCLUDING BUILT-IN LIBRARIES...
#include <stdio.h>
#include <stdlib.h>
//PRE-DEFINE CONSTANT VALUES...
#define MAXNUM -12    //defining an integer
#define PI 3.1415     //defining a float
#define END "\n\n\t\tProgram has ended!!\n"   //defining a string
//PRE-DEFINING CONSTANT OPERATIONS...
#define ADD(a, b, c) (a + b + c)    //Operation that will add its 3 parameters

int main(){
    //using other definitions to check if the current device is Windows or UNIX
    #ifdef _WIN32   
        printf("\nWindows Operating System Detected\n");
    #elif linux
        printf("\nUNIX Operating System Detected\n");
    #else
        printf("\nOperating System could NOT be identified!\n");
    #endif
    
    printf("\nUsing pre-defined values and operations: ");
    printf("\n • MAXNUM: %d",MAXNUM);       //using pre-defined integer
    printf("\n • PI: %f",PI);               //using pre-defined float
    printf("\n • ADD(): %.2f",ADD(2,5,99.5));   //using pre-defined function

    printf(END);    //using pre-defined string
    return 0;
}
ALeonidou

#ifdef in c

#include <stdio.h>
#define YEARS_OLD 10

int main()
{
   #ifdef YEARS_OLD
   printf("TechOnTheNet is over %d years old.\n", YEARS_OLD);
   #endif

   printf("TechOnTheNet is a great resource.\n");

   return 0;
}
Comfortable Curlew

C Wenn Aussage

if (test expression) 
{
   // code
}
SAMER SAEID

Ähnliche Antworten wie “#ifdef in c”

Fragen ähnlich wie “#ifdef in c”

Weitere verwandte Antworten zu “#ifdef in c” auf C#

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen