| 分類:[C/C++]
使用言語はCです
#include<stdio.h> #include<stdlib.h>
void strrev(char s[]) { char temp = '\0'; char *first = s; char *last = s;
while (*(last + 1) != '\0') { last++; }
while (first < last) { temp = *first; *first = *last; *last = temp;
first++; last--;
} return; }
int max(int a, int b) { return a > b ? a : b; }
void moveup(int a[], int b[],int c[],int i) { c[i] = (a[i] + b[i]) % 10; c[i + 1] = (a[i] + b[i]) / 10; }
int main(void) { int n, m; n = 0; char s1[100], s2[100]; int d1[100], d2[100], sum[100]; scanf("%s", s1); scanf("%s", s2); while (s1[n] != '\0'|| s2[n] != '\0') n++; if (n > 80)printf("overflow"); strrev(s1); strrev(s2); for (m = 0; m <= n; m++) { d1[m] = atoi(&s1[m]); d2[m] = atoi(&s2[m]); } for (m = 0; m <= n; m++) { moveup(d1[],d2[],sum[], m); }
}
以下のソースコードでd1[] d2[] sum[] m をmoveup に渡したいのですが 式が必要ですと表示されコンパイルできません。 どうしたら渡せるのでしょうか |