The recursive call of setp1 initialized elements 0...ASIZE.
This is out of bounds and now altered into 0..ASIZE-1.
This commit is contained in:
parent
b20e6856b6
commit
78bd26211d
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Author: E.G. Keizer */
|
/* Author: E.G. Keizer */
|
||||||
|
static char rcs_id[]= "$Header$" ;
|
||||||
|
|
||||||
/* test for structure parameters, assignment and return */
|
/* test for structure parameters, assignment and return */
|
||||||
# define ASIZE 26
|
# define ASIZE 26
|
||||||
@ -148,11 +149,11 @@ callt() {
|
|||||||
struct w3 setp1(count) {
|
struct w3 setp1(count) {
|
||||||
struct w3 myp ;
|
struct w3 myp ;
|
||||||
|
|
||||||
if ( count<0 ) {
|
if ( count<=0 ) {
|
||||||
return(myp) ;
|
return(myp) ;
|
||||||
}
|
}
|
||||||
myp = setp1(count-1) ;
|
myp = setp1(count-1) ;
|
||||||
myp.w3_a[count] = 99-count ;
|
myp.w3_a[count-1] = 99-count ;
|
||||||
return(myp) ;
|
return(myp) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user