
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
How to demonstrate Prefix Operator using C#?
The increment operator is ++ operator. If used as prefix on a variable, the value of variable gets incremented by 1. After that the value is returned unlike Postfix operator. It is called Prefix increment operator. In the same way the decrement operator works but it decrements by 1.
For example, ++a;
The following is an example demonstrating Prefix increment operator −
Example
using System; class Program { static void Main() { int a, b; a = 10; Console.WriteLine(++a); b = a; Console.WriteLine(a); Console.WriteLine(b); } }
Output
11 11 11
- Related Articles
- Demonstrate the concept of pointers using C language
- C++ program to demonstrate exception handling
- Prefix to Postfix Conversion in C++
- Prefix to Infix Conversion in C++
- Differentiate between the prefix and postfix forms of the ++ operator in java?
- Result of sizeof operator using C++
- C program to demonstrate fork() and pipe()
- C++ program to demonstrate multi-level inheritance
- C++ program to demonstrate function of macros
- C++ Program to Subtract Complex Number using Operator Overloading
- How to create JavaScript objects using new operator?
- How to query MongoDB using the $ne operator?
- Maximum subarray sum in O(n) using prefix sum in C++
- Prefix calculator using stack in JavaScript
- How to use ‘as’ operator in C#?

Advertisements