I always get error info when debuging which shows like "Unhandled exception at 0x004113ea in Utou.exe: 0xC0000005: Access violation writing location 0x00415835." at line " *s -= 32; " who can help what's the problem?
#include "stdafx.h"
#include <iostream>
using namespace std;
void ToUpperPtr(char* s)
{
//char *a;
//a=s;
while(*s != '\0')
{
if(*s >='a' && *s <='z')
*s -= 32;
s++; //
}
//printf("%s",a);
}
int _tmain(int argc, _TCHAR* argv[])
{
char *a="AbcdfrDFD";
ToUpperPtr(a);
//printf("%s",a);
int i;
scanf("%d",&i);
return 0;
}