Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: Clearing Arrays In C

2007-04-19 by kernels_nz

In this application, the arrays represent individual LEDS on the led
nameboard. These run as 8 * 8 modules from 4 * 16 bit Constant current
shift registers. Similar to 74HC494, but with Constant Current Drivers.

I need to clear the arrays everytime I change the display, I found it
faster clearing the arrays then just incrementing the indexes that
have LEDS that are to be on. I I were to assign either a 1 or 0 to
each one instead of just incrementing the ones that are on, it would
take longer than just clearing the arrays to start off with.

Hope that explains it a bit, from the different methods I tried, the
one where I clear the arrays first seems to compile to the smallest size. 

I was really just looking for a faster way to do this, I figured
someone may have come across a clever way using pointers.

Thanks for all the replies !

Cheers
Hein B
Auckland, New Zealand

--- In AVR-Chat@yahoogroups.com, "stevech11" <stevech@...> wrote:
>
> Below, do you mean that the array would be zero'd once each time the
> program runs (such as after a reset) ?  The K&R C standard and most
> run-time initialization programs do for sure zero static storage once. 
> 
> In my experience, it's rather rare to have to repeatedly zero out an
> array, from a programming technique and algorithm viewpoint. You might
> agree that zeroing an array implies you are later going to read
> elements of the array that have never been assigned a computed value.
> This is usually poor design.
> 
> --- In AVR-Chat@yahoogroups.com, David Appleton <englsprogeny@> wrote:
> >
> > Hey Guys,
> > 
> > Would this work as well?
> > 
> > 
> > 
> > static unsigned char array1[100];
> > 
> > 
> > [Non-text portions of this message have been removed]
> >
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.