#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <iostream>
using namespace std;
char toLowerChar(char a)
{
if((a >= 'A') && (a <= 'Z'))
{
return (a - ('A' - 'a'));
}
else
return a;
}
char * toLowerS(char * sSrcStr)
{
char * sDest = NULL;
if(sSrcStr)
{
int sLen = strlen(sSrcStr);
sDest = new char[sLen + 1];
if(sDest == NULL)
{
return NULL;
}
sDest[sLen] = '\0';
while(--sLen >= 0)
{
sDest[sLen] = toLowerChar(sSrcStr[sLen]);
}
}
return sDest;
}
int main()
{
char * s = "LSKDJ";
char * dest = toLowerS(s);
printf("%s\n",dest);
system("pause");
return 1;
}