void 指针的步长为1,而其他类型的指针的步长与其所定义的数据结构有关。

example:

1 #include<stdio.h>
2 main()
3 {
4 int a[10];
5 int *m=a;
6 void *n=(void *)a;
7 m++;
8 n++;
9 printf("%x\n%x\n%x",a,m,n);
}

输出结果为:

69255b90

69255b94

69255b91

相关文章:

  • 2021-11-16
  • 2022-12-23
  • 2021-04-05
  • 2020-11-01
  • 2021-06-12
  • 2021-06-18
  • 2017-12-22
猜你喜欢
  • 2021-07-05
  • 2021-11-19
  • 2021-10-14
  • 2021-12-06
  • 2021-08-24
  • 2022-01-10
相关资源
相似解决方案