DSPRelated.com
Forums

Can sb run 15 lines of code -> find error

Started by Marko Babic April 29, 2003
Hello,can somebody find the error by running this code on c6711dsk...JUST call
test_function() from main() and see if MAP_return[] contains values
[2..32,50,50]... My problem is that after call of calc_intersection() the
first_array_ptr does not point to MAP[] steadily => so that wron values are
used...WHY IS THIS SO ??? ANY
IDEAS...*****************************************************************
void calc_intersection(float *ptr_to_return_values, float *first_array_ptr,
short lenghtOf_1array, float *second_array_ptr, short lenghtOf_2array)
{
float* TestPtr;
short i, j;

TestPtr=second_array_ptr; //to hold the start-ardress

for(i=0; i<lenghtOf_1array; i++) //compare a value of array1 ..
{
for(j=0; j<lenghtOf_2array; j++) //with each value of array2
{
if((*second_array_ptr)==(*first_array_ptr) ) //if the value in both of
them
{
*ptr_to_return_values = *first_array_ptr; //write to return-array
ptr_to_return_values++;
}
second_array_ptr++;
}//***** END of j-loop *****
second_array_ptr=TestPtr;
first_array_ptr++;
}//***** END of i-loop *****

}//***************** END of CALC-INTERSECTION *******************
void test_function()
{
float MAP[31], MAP_hilfs[31], MAP_return[31];
short i;

//set starting values
for(i=0;i<31;i++)
{
MAP[i]=i;
MAP_hilfs[i]=i+2;
MAP_return[i]P;
}

//calculate intersection betwenn MAP[] and MAP_hilfs[] and write into
MAP_return[]
calc_intersection(MAP_return, MAP, 31, MAP_hilfs, 31);
}******************************************************************Thank you
for efforts, as I cannot solve the problemMarkan ---------------------------------
Gesendet von http://mail.yahoo.de.
!!! TOPHANDYS: 24 MONATE OHNE GRUNDGEBR AB 0,- !!! ...und viele andere
Schnchen bei www.discount-express.de.