天天看点

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;