From 09d0f9069776739db129bbbd594d0cecf4c1468b Mon Sep 17 00:00:00 2001 From: smallkun Date: Tue, 18 Mar 2025 08:52:39 +0800 Subject: [PATCH] Auto commit --- 2207/C语言同步练习源码/5.指针-1.c | 25 +++++++++++++++++++++++++ 2207/C语言同步练习答案.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 2207/C语言同步练习源码/5.指针-1.c 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