开发者

a="hello", b="bye", c=a*b then print c? [closed]

开发者 https://www.devze.com 2023-03-13 07:36 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly bro开发者_运维知识库ad, or rhetorical andcannot be reasonably answered in its current for
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly bro开发者_运维知识库ad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I came across one question like this

a="hello", b="bye", c=a*b

then what will the anwser of print c?


That depends on the implementation of the * operator on string data types. And that usually depends on the programming language you use. In most statically typed languages I know, this operator is not defined on strings.


In JavaScript, the value of c will be NaN.


It's a trick question, I think. You can't multiply a string with another string. I don't think any language allows this.

0

精彩评论

暂无评论...
验证码 换一张
取 消