注册 登录
编程论坛 C++教室

关于指针的一个小问题

虫虫飞ya飞 发布于 2007-11-12 11:25, 385 次点击
int *p;
p=new int;
p=35;
这样是没问题,如果换成另外一种方法为什么就不行呢

typedef int *ptr;
ptr p;
p=new int;
p=35;
4 回复
#2
aipb20072007-11-12 11:33
int *p;
p=new int;
p=35;

error:invalid conversion from 'int' to 'int*'
#3
虫虫飞ya飞2007-11-12 11:44
回复:(aipb2007)int *p;p=new int;p=35;error:inva...

笔误是 *p=35;
可能是我表达有问题,不过忽然把问题想通了还是谢谢

#4
nuciewth2007-11-12 16:21

(a*b)%m==((a%m)*(b%m))%m

#5
nuciewth2007-11-12 16:24

我吐血了,发错了地方.
顺便也看看吧
typedef int *ptr;

自定义类型 ptr==int *

#include<stdio.h>
typedef int* ptr;
int main()
{
int * p;
*p=35;
ptr q;
*q=35;
return 0;
}

1