Re: feb 10 '99 midterm question 2

Ed Casas (edc@ece.ubc.ca) Sun, 22 Oct 2000 17:37:10 -0700


Date: Sun, 22 Oct 2000 17:37:10 -0700
From: Ed Casas <edc@ece.ubc.ca>
Subject: Re: feb 10 '99 midterm question 2

> How does minchar(x,3) return 1? > shouldn't n = 4. (ie doesn't s have 4 characters - > 3,x,1 and 0) If the function thinks n is the number of characters to be tested, it can be passed a smaller value than the actual number of characters in the array with no ``ill effects.'' > if char x[5] = "3x10" why doesn't minchar return 0? minchar(x,4) would indeed return '0' (not 0). > or if 0 in "3x10" is the 0 that shows that the array > is finished, then shouldn't it be char x[4]? The last character in the string above is stored as the ASCII code for the character '0', not as the null character (the value 0) which terminates the string. -- Ed Casas edc@ece.ubc.ca http://casas.ece.ubc.ca +1 604 822-2592