diff --git a/2207/C语言同步练习源码/5.指针-1.c b/2207/C语言同步练习源码/5.指针-1.c new file mode 100644 index 0000000..2cd156e --- /dev/null +++ b/2207/C语言同步练习源码/5.指针-1.c @@ -0,0 +1,25 @@ +#include + +int main(){ + int a[10], b[10]; + int i; + int *p, *q; + + for(i=0, p=a;i<10;i++){ + scanf("%d", p++); + } + for(i=0, p=a, q=b;i<10;i++){ + if(*p%2==0){ + *q++=*p; + } + p++; + } + for(i=0, p=b;i + +int main(){ + int a[10], b[10]; + int i; + int *p, *q; + + for(i=0, p=a;i<10;i++){ + scanf("%d", p++); + } + for(i=0, p=a, q=b;i<10;i++){ + if(*p%2==0){ + *q++=*p; + } + p++; + } + for(i=0, p=b;i