乘二号阵列 [英] Multiplying two number arrays
问题描述
谁能告诉我如何乘两个数字数组用C?数阵列基本上是由包含数字两个字符串的。如:123456和132465
Can anyone please tell me how to multiply two number arrays in C? The number arrays are basically derived from two strings containing digits. eg: 123456 and 132465.
编辑:我有两个字符串作为 S1 =123456
和 S2 =132546
。然后我转换这两个字符串到整数数组即INT IS1 [6]和IS2 [6],这样
I had two string as S1 = "123456"
and S2="132546"
. I then converted these two strings into array of ints i.e. int IS1[6] and IS2[6] so that
IS1[1] = 1, IS1[2] = 2......
和
IS2[1] = 1, IS2[2] = 3.....
现在我必须mulitply这两个arrrays。请帮助。
Now I have to mulitply these two arrrays. Please help.
推荐答案
目前还不清楚要乘什么。如果您需要将两个空值终止字符串中的一个的char []
,你可以将它们转换为 INT
值与的atoi
:
It's not clear what exactly you want to multiply. If you need to multiply two null terminated strings in a char[]
, you can convert them to int
values with atoi
:
int result = atoi(str1) * atoi(str2);
这篇关于乘二号阵列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!