printf和cout从右到左计算:

int main()
{
/*
    char* str = NULL;
    setmemory(&str, 100);
    strcpy(str, "hello");
    cout << str << endl;
*/
    int arr[] = {6,7,8,9,10};
//    int* ptr = arr;
    int* mp = arr;
//    *(++ptr) += 123;     //arr[1] = 130
    cout << *mp << " " << *(mp++) << " " << *mp << endl;   //6 6 7
  cout << *mp << " " << *(++mp) << " " << *mp << endl; //6 7 7 cout
<< *mp << endl; // printf("%d,%d,%d", *ptr,*(ptr++),*ptr); // cout << *ptr << endl << *(++ptr) << endl; return 0;

 a++和++a都是先自增,区别在于a++自增后将自增前的值通过临时变量返回。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
  • 2021-10-07
  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-29
  • 2021-12-02
  • 2021-05-20
  • 2022-01-18
  • 2021-06-13
相关资源
相似解决方案