C函数返回字符串

#include "stdio.h"

#define KEY 5;

int main()

{

char password[50] = "123456";

encrypt(password);

printf("加密后的字符串为:",password);

return 1;

}

 

/**

*加密函数

*返回字符串数组。数组名即数组的首地址,所有声明 char * 可以表示返回数组。

**/

char * encrypt(char password[])

{

int i = 0;

int count = strlen(password);

for(;i<count;i++)

{

password[i] = password[i] + i + KEY;

}

return password;

}

posted @ 2017-02-28 21:09  N神3  阅读(362)  评论(0编辑  收藏  举报