Search code examples
carraysavr

Reading line by line in String Array


I have an array which is stored in my program memory

const char* const paragraph[] PROGMEM = {
    "First Line",
    "Second Line"
};

How do I read one string at a time so that it output

First Line
Second Line

Solution

  • int i;
    for (i = 0; i < sizeof(paragraph)/sizeof(paragraph[0]); ++i) {
        printf("%s\n", paragraph[i]);
    }