I written a very simlpe function in c and a main program to go with it:
Code:
void ToUpper(char * S)
{
while (*S!='\0')
{
if (*S >= 'a' && *S <= 'z')
{
*S +='A'+ -'a';
}
S++;
}
}
int main()
{
char * sentence = "acbMNPtuv";
printf("%s\n",sentence);
ToUpper(sentence);
printf("after function: %s\n",sentence);
return 0;
}
i debugged it and there seems to be a problem with:
*S +='A'+ -'a';
why?? i'm not drefrencing a NULL pointer so what the hell could be the problem??
thanks

