Answer to Question #200044 in C for Ayesha

Question #200044

write a c program to

Create an array of character strings and fill it with arbitrary strings of your choice. Pass it into a function named

“printStrings”. It should print all the strings inside the array. Note: You need to create an array of type char*.

[3:32 AM]

please help me in this


1
Expert's answer
2021-05-28T18:44:35-0400
#include <stdio.h>

void printStrings(char** data, int size)
{
    int i;
    for(i=0; i<size; ++i)
    {
        printf("%s\n", data[i]);
    }
}

int main()
{
    char* data[] = {"To", "be", "or", "not", "to", "be", "that", "is", "the", "question"};
    int size = sizeof(data) / sizeof(data[0]);

    printStrings(data, size);

    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS