Computer Science, asked by AnkitMahara, 4 days ago

Write a program to input a word and store each character in each cell of an array. Print the array. Variable description is compulsory.pls answer legitimately fast​

Answers

Answered by abmatt1020
0

Answer:

char array[][20] = {"Geek1", "Geek2", "Geek3", ..."};

// Declaration of 2-D char array

// where n is the number of words

char array[n][20];

// Initialization of 2-D char array

for (i = 0; i < n; i++)

   scanf("%s", array[i]);

// C program to store words in an array

#include <stdio.h>

int main()

{

int i;

// Lets say we have 3 words

int n = 3;

// Declaration of 2-D char array

char array[n][20];

// Initialization of 2-D char array

for (i = 0; i < 3; i++)

 scanf("%s", array[i]);

// print the words

for (i = 0; i < 3; i++)

 printf("%s\n", array[i]);

return 0;

}

Explanation:

// C program to store words in an array

#include <stdio.h>

int main()

{

int i;

// Direct initialization of 2-D char array

char array[][20] = { "Geek1", "Geek2", "Geek3" };

// print the words

for (i = 0; i < 3; i++)

 printf("%s\n", array[i]);

return 0;

}

// C program to store words in an array

#include <stdio.h>

int main()

{

int i;

// Direct initialization of 2-D char array

char array[][20] = { "Geek1", "Geek2", "Geek3" };

// print the words

for (i = 0; i < 3; i++)

 printf("%s\n", array[i]);

return 0;

}

this is the program written in c++

expert answer mark me brainliest

Similar questions