为什么不允许乘法? [英] Why multiplication not allowed?

查看:101
本文介绍了为什么不允许乘法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




为什么不允许乘法指针?

直到现在我才知道这一点,但不是原因!


PS:作为一项规则,我搜索了常见问题解答,但无法找到答案。


-

Vijay Kumar R Zanvar

我的主页 - http://www.geocities.com/vijoeyz/

推荐答案

" Vijay Kumar R Zanvar" < 6 ***** @ hotpop.com>写道:
"Vijay Kumar R Zanvar" <vi*****@hotpop.com> writes:
为什么不允许乘法指针?
直到现在我才知道这一点,但不是原因!
Why multiplication of pointers is not allowed?
Till now I only know this, but not the reason why!



指针乘法意味着什么?



What would multiplication of pointers mean?




Ben Pfaff < bl*@cs.stanford.edu>在消息中写道

news:87 ************ @ pfaff.stanford.edu ...

"Ben Pfaff" <bl*@cs.stanford.edu> wrote in message
news:87************@pfaff.stanford.edu...
" Vijay Kumar R Zanvar" < 6 ***** @ hotpop.com>写道:
"Vijay Kumar R Zanvar" <vi*****@hotpop.com> writes:
为什么不允许乘法指针?
直到现在我才知道这一点,但不是原因!
Why multiplication of pointers is not allowed?
Till now I only know this, but not the reason why!


指针乘法是什么意思?



What would multiplication of pointers mean?




#include< stdio.h>

#include< stdlib.h>


int

main(无效)

{

int i = 10;

int * k =& i,* j =& i;


k = k * j;

返回EXIT_SUCCESS;

}


这给出了一个错误:


ptr_mul.c:在函数`main''中:

ptr_mul.c:10:错误:无效操作数到二进制*



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

int
main ( void )
{
int i = 10;
int *k = &i, *j = &i;

k = k * j;
return EXIT_SUCCESS;
}

This gives an error:

ptr_mul.c: In function `main'':
ptr_mul.c:10: error: invalid operands to binary *


" Vijay Kumar R Zanvar" < 6 ***** @ hotpop.com>写道:
"Vijay Kumar R Zanvar" <vi*****@hotpop.com> writes:
" Ben Pfaff" < bl*@cs.stanford.edu>在消息中写道
新闻:87 ************ @ pfaff.stanford.edu ...
"Ben Pfaff" <bl*@cs.stanford.edu> wrote in message
news:87************@pfaff.stanford.edu...
" Vijay Kumar R Zanvar" < 6 ***** @ hotpop.com>写道:
"Vijay Kumar R Zanvar" <vi*****@hotpop.com> writes:
为什么不允许乘法指针?
直到现在我才知道这一点,但不是原因!
指针乘法意味着什么?
Why multiplication of pointers is not allowed?
Till now I only know this, but not the reason why!
What would multiplication of pointers mean?



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

int
main(void)
{
int i = 10;
int * k =& i,* j =& i;

k = k * j;



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

int
main ( void )
{
int i = 10;
int *k = &i, *j = &i;

k = k * j;




你的意思是

* k = * k * * j;

换句话说,乘以`int',不是指向`int'的指针。

返回EXIT_SUCCESS;
}



You mean
*k = *k * *j;
In other words, multiply `int''s, not pointers to `int''s.
return EXIT_SUCCESS;
}




指针和它们的指示物之间的区别很大

基本面。您是否考虑过阅读课本或参加

课程?

-

我没有C& V方便,但我有Dan Pop。

--E。 Gibbons



The difference between pointers and their referents is pretty
fundamental. Have you considered reading a textbook or taking a
class?
--
"I don''t have C&V for that handy, but I''ve got Dan Pop."
--E. Gibbons


这篇关于为什么不允许乘法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆