C/C++ 언어 포인터 배열의 연산에 대한 예제 프로그램


1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* 포인터 배열의 연산에 대한 예제 프로그램 */
#include <stdio.h>
 
void main(void) {
  char *fruit[]={"apple""orange""grape""banana"};
  char **ptr1[]={fruit+3, fruit+2, fruit+1, fruit};
  char ***ptr2 = ptr1;
 
  printf("(1)  %s\n"**++ptr2);
  printf("(2)  %s\n"*--*++ptr2+3);
  printf("(3)  %s\n"*ptr2[-2]+3);
  printf("(4)  %s\n", ptr2[-1][-1]+1);
}
 
cs


C/C++ 언어 포인터 배열의 연산에 대한 예제 프로그램



+ Recent posts