C언어에서 ++,--로 표현되는 증감 연산자를 간단한 예제를 통해서
학습해 보자.
File : TestBed.h
#include <stdio.h>
void do_increment_operator(int param);
void do_decrement_operator(int param);
void do_increment_pointer_operator(int* param);
void do_decrement_pointer_operator(int* param);
void do_inrement_decrement_tester();
void do_pointer_increment_decrement_tester();
File : TestBed.cpp
#include "TestBed.h"
void do_increment_operator(int param)
{
int tValue = param;
//printf("Value Increment 1 : %d\n", tValue++);
printf("Value Increment 1 : %d\n", ++tValue);
printf("Value Increment 1 : %d\n", tValue);
}
void do_decrement_operator(int param)
{
int tValue = param;
//printf("Value Increment 1 : %d\n", tValue--);
printf("Value Increment 1 : %d\n", --tValue);
printf("Value Increment 1 : %d\n", tValue);
}
void do_increment_pointer_operator(int* param)
{
int* pValue = param;
printf("Value Increment 1 : %p\n", --pValue);
printf("Value Increment 1 : %p\n", pValue);
}
void do_decrement_pointer_operator(int* param) {
int* pValue = param;
}
void do_inrement_decrement_tester()
{
//do_increment_operator(3);
do_decrement_operator(3);
}
void do_pointer_increment_decrement_tester()
{
}
File : PlayGround.cpp
#include "TestBed.h"
int main(const int argc, const char* argv[])
{
do_inrement_decrement_tester();
}