troubleshooting Question

Visual C++ 6.0/Windows XP

Avatar of sa9813
sa9813 asked on
C++
7 Comments1 Solution328 ViewsLast Modified:
The function below runs perfect on Windows 2000 using Visual C++ 6.0. Running the same function on Windows XP professional using Visual C++ 6.0 on the other hand causes an accessviolation! How come, there have to be away around this!

void reverse(char *str){
  int lh, rh;
  char tmp;
  for (lh = 0, rh = strlen(str) - 1; lh<rh; lh++, rh--){
    tmp = str[lh];
    str[lh] = str[rh]; //accessviolation!
    str[rh] = tmp;
  }
}
ASKER CERTIFIED SOLUTION
pjknibbs

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros