char s[9];
Franny
Posts: 127
Howdy,
I was working on this exercise:
http://learn.parallax.com/propeller-c-simple-circuits/seven-segment-display
and at the bottom the second code example has the line "char s[9];" and I was just wondering what's it for? I removed it and it works fine...
I was working on this exercise:
http://learn.parallax.com/propeller-c-simple-circuits/seven-segment-display
and at the bottom the second code example has the line "char s[9];" and I was just wondering what's it for? I removed it and it works fine...
/*
Seven Segment.c
Display digits on a 7 segment (common cathode) LED display.
http://learn.parallax.com/propeller-c-simple-circuits/seven-segment-display
*/
#include "simpletools.h" // Include simpletools
int n[] = {0b11100111, 0b10000100, 0b11010011,
0b11010110, 0b10110100, 0b01110110,
0b01110111, 0b11000100, 0b11110111,
0b11110100};
char s[9];
int main() // main function
{
set_directions(15, 8, 0b11111111); // P15...P8 -> output
pause(1000);
for (int i = 0; i < 10; ++i)
{
set_outputs(15, 8, n[i]); // 0 -> 7-segment display
print("n[%d] displayed.\n", i);
pause(1000);
}
}

Comments
Thanks, do you maybe have a link of an example of when it's used?