PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
C Intro
Basics
Index Array Variables.c
1
/*
2
Index Array Variables.c
3
4
Use a for loop to display all the elements in an array.
5
6
http://learn.parallax.com/propeller-c-start-simple/index-array-variables
7
*/
8
9
#include "
simpletools.h
"
// Include simpletools
10
11
int
main
()
// main function
12
{
13
int
p[] = {1, 2, 3, 5, 7, 11};
// Initialize the array
14
for
(
int
i = 0; i < 6; i++)
// Count i from 0 to 5
15
{
16
print
(
"p[%d] = %d\n"
, i, p[i]);
// Display array element & value
17
pause
(500);
// 1/2 second pause
18
}
19
}
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
print
int print(const char *format,...) __attribute__((format(printf
Print format "..." args to the default simple terminal device. The output is limited to 256 bytes.
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17