» An ultimate catalog of computer data
Forum posts for alg.exe
Exception during char operation
I'm practising programming and got something and I don't know the reason.
Here is my source with the place of the error:
#include <iostream>
#include <string.h>
#include <vector>
#include <stdio.h>
int main()
{
// the max length of one line is given
std::vector<char*> tmp = {'abc', 'abcba', 'abcd'};
for (char *input : tmp)
{
int counter = 0;
int length = strlen(input);
char *start = &input[0];
char *end = &input[length - 1];
while (start < end)
{
while (*start < *end)
{
char s = *end;
s--;
*end = s; /*Unhandled exception at
0x009398EE in alg.exe: 0xC0000005:
Access violation writing location 0x00940D5E.*/
counter;
}
start++;
end--;
}
std::cout << counter << std::endl;
}
return 0;
}
I know I could decrement in one line, but it's in three lines because of debugging.
Why cannot I change the value of (*end) ?
I would thank every idea.
Tamás
View complete forum thread with replies
Other posts related to alg.exe
See Related Forum Messages: Follow the Links Below to View Complete Thread
Could not find system file when it actually exists
results from debug diff from release
can a windows service be spawned from something other than services.exe?
Exception during char operation