mercredi 8 avril 2015

Flood fill an array in C


Vote count:

-1




I'm wondering how to program a flood fill in C, so that it can fill an array with a bunch of 0's and any other number for a line (let's say 9) with different numbers on the connected dots. Example:


0000000000000000900000000000000000000000 0000000000000000900000000000000000000000 0000000000000000900000000000000000000000 0000000000000000900000000000000000000000 0000000000000000900000000000000000000000 0000000000000000900000000099999999999999 0000000000000000900000000000000000000000 0000000000999999900000000000000000000000 0000000000000000900000000000090000000000 0000000000000000900000000000090000000000 0000000000000000900000000000090000000000 9999999999999999999999999999999999999999 0000000000000000900000000000090000000000 0000000000000000900000000000090000000000 0000000000000000900000000000090000000000 0000000000000000900000000000090000000000 0000000000000000900000000000090000000000 0000000000000000900000000000090000000000


would become


1111111111111111922222222222222222222222 1111111111111111922222222222222222222222 1111111111111111922222222222222222222222 1111111111111111922222222222222222222222 1111111111111111922222222222222222222222 1111111111111111922222222299999999999999 1111111111111111922222222222222222222222 1111111111999999922222222222222222222222 1111111111111111922222222222292222222222 1111111111111111922222222222292222222222 1111111111111111922222222222292222222222 9999999999999999999999999999999999999999 3333333333333333944444444444495555555555 3333333333333333944444444444495555555555 3333333333333333944444444444495555555555 3333333333333333944444444444495555555555 3333333333333333944444444444495555555555 3333333333333333944444444444495555555555



asked 1 min ago







Flood fill an array in C

Aucun commentaire:

Enregistrer un commentaire