[Tfug] Need help with a C++ algorithm
Brian Murphy
murphy+tfug at email.arizona.edu
Thu Mar 15 02:27:26 MST 2007
Quoting Stephen Hooper <stephen.hooper at gmail.com>:
> Hate to disagree with you there dude, but yes there is:
You're making a really heavy assumption on the implementation of malloc
to achieve your results.
You don't account for the fact that a pointer can point to a memory
region not created by malloc.
For example, replace your
start = malloc(strtol(argv[1],NULL,16) * sizeof(char));
with
char string[100];
start = string;
QED. :-)
Brian
The opinions or statements expressed herein are my own and should not be
taken as a position, opinion, or endorsement of the University of
Arizona.
More information about the tfug
mailing list