Skip to content

Commit b12fb01

Browse files
authored
Created preincrement_and_postincrement.c
This file explains the implementation of pre and post increment
1 parent 21e718f commit b12fb01

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

preincrement_and_postincrement.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// ++i
2+
int pre_increment(i) {
3+
i += 1;
4+
return i;
5+
}
6+
// i++
7+
int post_increment(i) {
8+
copy = i;
9+
i += 1;
10+
return copy;
11+
}
12+
13+
void main() {
14+
printf("%d", pre_increment(2));
15+
printf("%d", post_increment(2));
16+
}

0 commit comments

Comments
 (0)