small medium large xlarge

Back to: All Forums  Arduino
Generic-user-small
01 Apr 2011, 01:30
Lawrence Gill (9 posts)

On page 121 the sketch lines 11 and 12 are

@int buffer[NUM_AXES][BUFFER_SIZE];@ @int buffer_pos[NUM_AXES] = { 0 };@

in which you are creating a buffer and assigning a pointer for the buffer. Line 12 sets the pointer to zero to begin. But I can’t find any information telling why you have the zero value inside braces, as in { 0 }?

All I found online is that “curly braces” are used for a multitude of things in the C language and its variants. But nothing to tell me why you used them here.

(Later)

Hi Maik,

I was able to learn what that statement means with the help of the Arduino forum. You are simply initializing ALL THREE of the array’s elements to zero in a single step. A very handy instruction!

Generic-user-small
13 Apr 2011, 09:37
ufaklo2 (1 post)

good post

You must be logged in to comment