Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

preprocessors in c#

Directive		Description
#if				#elif
#else			#endif
If				Else if
Else			End if
#define			Symbol define
#undef			Symbol undefine
#error			Generate error
#warning		Generate warning
#line			Set line number
#region			Mark section start
#endregion		Mark section end
Comment

C #define preprocessor

#include <stdio.h>
#define PI 3.1415

int main()
{
    float radius, area;
    printf("Enter the radius: ");
    scanf("%f", &radius);

    // Notice, the use of PI
    area = PI*radius*radius;

    printf("Area=%.2f",area);
    return 0;
}
Comment

C #define preprocessor

#include <stdio.h>
#define PI 3.1415
#define circleArea(r) (PI*r*r)

int main() {
    float radius, area;

    printf("Enter the radius: ");
    scanf("%f", &radius);
    area = circleArea(radius);
    printf("Area = %.2f", area);

    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: vb.net datagridview set row index 
Csharp :: c# get last array element 
Csharp :: take photo function in unity 
Csharp :: httpclient 
Csharp :: entity framework with query C# 
Csharp :: select distinct linq mvc 
Csharp :: c# callback param 
Csharp :: how-to-add-new-column-with-value-to-the-existing-datatable 
Csharp :: c# to pascal case 
Csharp :: unity werfen mit höhe 
Csharp :: c# jagged array initialization 
Csharp :: run in new thread C# 
Csharp :: sucess messages in c# 
Csharp :: c# merge two lists as queryable 
Csharp :: moq set delay to return 
Csharp :: how to serialize a property in unity 
Csharp :: C# top down view player movement script 
Csharp :: blazor clientside cookies 
Csharp :: unity datetime to string 
Csharp :: if input.get touch 
Csharp :: c# enum get string value 
Csharp :: load a form from button c# 
Csharp :: recorrer list c# 
Csharp :: lwjgl fullscreen 
Csharp :: c# winforms datagridview bind to list 
Csharp :: c# property attribute 
Csharp :: the underlying connection was closed nuget 
Csharp :: unity camera.main.screentoworldpoint(input.mouseposition) not working 
Csharp :: c# WriteLine() 
Csharp :: escape in c# 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =