天天看點

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;