- 论坛徽章:
- 0
|
本帖最后由 churchmice 于 2010-08-20 01:15 编辑
回复 13# cu养猪小能手
没看懂你到底想干啥
至于那么麻烦么?
- #include "stdio.h"
- int main (int argc, char *argv[])
- {
- int i;
- int *pi = NULL;
- int **ppi;
- i = 1;
- pi = &i;
- ppi = π
- printf ("i is %d\n\n", i);
- printf ("pi is %d\n\n", *pi);
- printf ("ppi is %d\n\n", **ppi);
- return 0;
- }
复制代码 你的代码需要改成下面这样的
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- int main(int argc,char *argv[])
- {
- int i;
- int *pi=NULL;
- int **ppi;
-
- i = 1;
- pi = &i;
-
- ppi = (int **)malloc(sizeof(int **));
- *ppi = pi;
-
- printf("i is %d\n\n",i);
- printf("pi is %d\n\n",*pi);
- printf("ppi is %d\n\n",**ppi);
- free(ppi);
- return 0;
- }
复制代码 |
|