189 8069 5689

c语言编程题目函数指针 c语言程序设计指针编程题

C语言指针编程题,求大佬解答

#include stdio.h

目前成都创新互联公司已为上千多家的企业提供了网站建设、域名、虚拟主机网站托管、企业网站设计、洛宁网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

void myitoa(int n,char*str)

{int i,j;

char t;

for(i=0;n;i++)

{str[i]='0'+n%10;

n/=10;

}

str[i]='\0';

for(j=0,i--;ji;j++,i--)

{t=str[i];str[i]=str[j];str[j]=t;}

}

int main()

{ int n;

char s[20];

scanf("%d",n);

myitoa(n,s);

printf("%s\n",s);

return 0;

}

【高分悬赏】C语言编程题 指针

#include stdio.h

#include stdlib.h

#include string.h

#define MAX_N 20

#define MAX_DST 200

char *sub_str_cp(char *src, char *dst, int m)

{

char *dst_o = dst;

if (NULL==src || NULL==dst ||

strlen(src)MAX_N || m1 || mMAX_N)

return NULL;

src += m-1;

while (*(dst++) = *(src++));

return dst_o;

}

char *str_join(char *src1,char *src2,char *dst)

{

char *dst_o = dst;

if (NULL==src1 || NULL==src2 || NULL==dst)

return NULL;

while (*(dst++) = *(src1++));

dst -= 1;

while (*(dst++) = *(src2++));

return dst_o;

}

int ins_sort(int iArr[],int num,int new_one)

{

if (NULL == iArr || num+1 = MAX_DST)

return 0;

int *p = iArr + num - 1;

while (p = iArr new_one *p)

{

*(p+1) = *(p);

p--;

}

*(p+1) = new_one;

return num+1;

}

// 删除从字符数组dst中首次出现的字符del_c

char *del_char(char *dst,char del_c)

{

int idx = 0;

char *dst_o = dst;

if (NULL == dst) return NULL;

while ('\0' != *dst)

{

if (*(dst++) != del_c)

*(dst_o + idx++) = *(dst-1);

}

return dst_o;

}

int main()

{

char src[MAX_N+1],src1[MAX_N+1],src2[MAX_N+1];

char dst[MAX_DST+1];

char cA;

int ins_new,num_of_iArr,iA;

int iSort[MAX_DST] = {12,23,32,55,100,101,205,309};

// sub str cp

int m;

printf("subject 1. strcpy\n");

printf("input string(length = %d):",MAX_N);

scanf("%s",src);

printf("copy string from position(1=m=%d):",MAX_N);

scanf("%d",m);

printf("string have been copied:%s\n",sub_str_cp(src,dst,m));

// str join

printf("\nsubject 2. strcat\n");

printf("input string1(length = %d):",MAX_N);

scanf("%s",src1);

printf("input string2(length = %d):",MAX_N);

scanf("%s",src2);

printf("string after joining:%s\n",str_join(src1,src2,dst));

// array sort

printf("\nsubject 3. sorting\n");

num_of_iArr = 8;

printf("oringinal array:\n");

for (iA=0; iAnum_of_iArr; iA++)

printf("%d\t",iSort[iA]);

printf("\ninsert an integer:");

scanf("%d",ins_new);

num_of_iArr = ins_sort(iSort,num_of_iArr,ins_new);

printf("array after sorting:\n");

for (iA=0; iAnum_of_iArr; iA++)

printf("%d\t",iSort[iA]);

printf("\n");

// del elem of array

getchar();

printf("\nsubject 4. del\n");

printf("string:%s\n",dst);

printf("del ? character from above string:");

scanf("%c",cA);

printf("string after deleting %c:%s\n",cA,del_char(dst,cA));

return 0;

}

C语言指针一道简单的编程题

按照你的要求编写的C语言程序如下

includestdio.h

int main()

{

int a,b;

int *p=a;

a=30;

printf("a=%d\n",*p);

p=b;

scanf("%d",p);

a=*p+24;

printf("a=%d,b=%d",a,b);

return 0;

}

运行结果

a=30

76

a=100,b=76

c语言指针编程题求解。

#include "stdio.h"

void Sum(int (*p)[3],int total[],int n)//n是总行数

{

int i,j;

for(i=0;in;i++)

{

for (j=0;j3;j++)

{

total[i]=total[i]+*(*(p+i)+j);

}

}

}

int main()

{

int a[2][3]={};

int total[2]={0,0};

int i,j;

printf("输入数组a:\n");

for(i=0;i2;i++)

{

for (j=0;j3;j++)

{

scanf("%d",a[i][j]);

}

}

Sum(a,total,2);

printf("各行的和:\n");

for(i=0;i2;i++)

printf("%d\n",*(total+i));

return 0;

}

C语言指针型函数编程题,求大虾~~

#include "stdio.h"

char *strins (char* s1, char* s2) {

int a = 0, b = 0;

while (s1[a++]);

while (s2[++b]);

while (a--) {

s1[a + b] = s1[a];

}

while (b--) {

s1[b] = s2[b];

}

return s1;

}

int main() {

char s1[20];

char s2[20];

gets(s1);

gets(s2);

printf("c:%s", strins(s1,s2));

}


名称栏目:c语言编程题目函数指针 c语言程序设计指针编程题
网页路径:http://jkwzsj.com/article/doocjhg.html

其他资讯