*p++ 和 (*p)++

  1. 分析
    (*p)++,是先取指针P的值,然后对其值进行++运算;
    (* p++)同 *(p++),因为++的优先级相对较高:是先对指针P进行++运算,然后再取取值。

  2. 示例

#include<stdio.h>
#include "stdlib.h"
#include "stdint.h"

uint8_t p[] = {"test"};

int main()
{
   uint8_t* p_tmp = p;

   printf("p = %d\n\r", p_tmp);
   printf("p = %s\n\r", p_tmp);

   printf("*p_tmp++   = %c \n\r", *p_tmp++);
   printf("(*p_tmp)++ = %c \n\r", (*p_tmp)++);

   system("pause"); 
   return 0;
}

运行结果如下:
这里写图片描述

猜你喜欢

转载自blog.csdn.net/u010603798/article/details/74178032