C语言BT问题

Python016

C语言BT问题,第1张

函数原型 char *strcat(char *dest,char *src)

函数要做的就是把src所指字符串添加到dest结尾处(覆盖dest结尾处的'\0')并添加'\0'。返回指向dest的指针。

举例

// strcat.c

#include <syslib.h>

#include <string.h>

main()

{

char d[20]="Golden Global"

char *s=" View"

clrscr()

strcat(d,s)

printf("%s",d)

getchar()

return 0

}

程序执行结果为:

Golden Global View

#include "stdio.h"

#define nmax 50

main()

{

int j,k,TaoTai,m,n,i,num[nmax],*p

printf("please input the total of numbers:")

scanf("%d",&m)

printf("input n:")

scanf("%d",&n)

printf("input i:")

scanf("%d",&i)

p=num

for(j=0j<mj++)

*(p+j)=j+1

j=i-1

k=0

TaoTai=0

while(TaoTai<m)

{

if(*(p+j)!=0) k++

if(k==3)

{ *(p+j)=0

k=0

TaoTai++

printf("%d ",j+1)

}

j++

if(j==m) j=0

}

}