1.
#include <stdio.h>voidSumint*P)//sum all elements and output the result{ inti,sum=0; for(i=0;i<5; i++) Sum=sum+*p++; printf ("sum result is%d", sum);}intMain () {inta[]={1,3,5,7,9}; int*p=A; SUM (p);return 0;}
2.
#include <stdio.h>#include<string.h>intMain ()//output 5 strings in order from small to large{ Chara[5]; Char*p; P=A; inti,j,t; printf ("Please enter a string (up to 5 characters):"); for(i=0;i<5; i++) scanf ("%c",&P[i]); for(i=0;i<5; i++) { for(j=4;j>0; j--) { if(a[j]<a[j-1]) {T=A[j]; A[J]=a[j-1]; A[j-1]=T; }}} printf ("from small to large for:"); for(i=0;i<5; i++) printf ("%c", *p++); return 0; }
3.
#include <stdio.h>#include<stdlib.h>intMain ()//space initialization simultaneously prints output space content{ inta[Ten],i; int*p= (int*) malloc (Ten*sizeof(int)); printf ("Please enter a total of 10 integers:"); for(i=0;i<Ten; i++) {scanf ("%d",&P[i]); } printf ("Initialize the contents of the space:"); for(i=0;i<Ten; i++) {printf ("%d", P[i]); } free (p);return 0;}
4.
#include <stdio.h>intMain ()//space initialization, while printing output space content{ inta[Ten][Ten]={{1,2,3},{4,5},{6,7,8},{9}}; int*p[Ten]; inti,j; for(i=0;i<Ten; i++) { for(j=0;j<Ten; j + +) {printf ("%d", * (a[i]+j)); } printf ("\ n"); }return 0; }
Ah ~, a little chaotic ...
11th Time Assignment