C Online Compiler
Example: Post-increment Operator Demonstration in C
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// Post-increment Operator Demonstration #include <stdio.h> int main() { // Step 1: Initialize a variable int a = 10; printf("Initial a: %d\n", a); // Step 2: Use post-increment in an expression int b = a++; // 'a's original value (10) is assigned to 'b', then 'a' is incremented to 11 printf("After b = a++;\n"); printf("a: %d\n", a); // a is 11 printf("b: %d\n", b); // b is 10 return 0; }
Output
Clear
ADVERTISEMENTS