Wrox Programmer Forums
|
BOOK Programming Interviews Exposed: Secrets to Landing Your Next Job 2nd Ed ISBN: 978-0-470-12167-2
This is the forum to discuss the Wrox book Programming Interviews Exposed: Secrets to Landing Your Next Job, 2nd Edition by John Mongan, Noah Suojanen, Eric Giguère; ISBN: 9780470121672
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK Programming Interviews Exposed: Secrets to Landing Your Next Job 2nd Ed ISBN: 978-0-470-12167-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 30th, 2010, 11:13 PM
Registered User
 
Join Date: Mar 2010
Posts: 8
Thanks: 0
Thanked 8 Times in 8 Posts
Default removeChars length of remove

On Page 78, in the removeChars code, an error occurs:

Code:
for( src = 0; src < len; ++src ){
    flags[r[src]] = true;
}
However, at this point in the code, len refers to the length of s, also the length of str.

Instead, it should use the length of r, so as to not walk past the end of the r array.

For instance:

Code:
int lenr = r.Length;
for( src = 0; src < lenr; ++src ){
    flags[r[src]] = true;
}
Regards,
-Matt
The Following User Says Thank You to MattCruikshank For This Useful Post:
WayneHeym (May 27th, 2011)





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remove remove elements deep using xsl Prabeen XSLT 1 May 5th, 2009 12:55 AM
length is null? darkhalf Javascript 2 October 19th, 2005 12:22 AM
Location.length=0 jack12345 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 June 21st, 2005 01:14 AM
length crmpicco Classic ASP Basics 1 February 11th, 2005 11:24 AM
LENGTH OF TD viren_balaut Javascript How-To 1 September 8th, 2004 08:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.