[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug on array manipulation?
From: |
Jürgen Kahrs |
Subject: |
Re: Bug on array manipulation? |
Date: |
Wed, 20 Dec 2006 14:44:39 +0100 |
User-agent: |
Thunderbird 1.5.0.8 (X11/20060911) |
Joao Batista Souza de Oliveira wrote:
> # Message
> print "Change all " Cl[ mj ] " to " Cl[ mi ];
Insert this one:
Clmj = Cl[ mj ]
>
> # Print array indices and array elements
> for ( j = 1; j <= N; j++ ) printf "%4d ", j;
> print;
>
> # Print array elements
> # Highlight the ones to be changed
> for ( j = 1; j <= N; j++ )
> if ( Cl[ j ] == Cl[ mj ] )
> printf " [%2d]", Cl[ j ];
> else
> printf "%4d ", Cl[ j ];
> print;
>
> # Change elements
> for ( j = 1; j <= N; j++ )
> if ( Cl[ j ] == Cl[ mj ] ) Cl[ j ] = Cl[ mi ];
Here is the bug ^^^^^^^^^^^
It should be
> if ( Cl[ j ] == Clmj ) Cl[ j ] = Cl[ mi ];
It's _your_ bug, not AWK's.