Hi, i want to read some number of strings(say 4 names) , and write them when i wanted later in the program. I tried by the following code. but it did'nt worked out. i'm getting the output of the last name. Please go through the code.

Code:
#include<iostream>
using namespace std;

int main()
{
        char name[6],*p[3];  //declaring names and pointer to hold those names.
	
	for(int i=0; i<=2; i++)
	{
		for(int j=0; j<=5;j++)
		{
			cin>>name[j];   //used to get names 
		}

		p[i]=name;
				
	}

	 for(int i=0; i<=2; i++)
	 {
		 cout<<p[i]<<"\n";
	 }

	 return 0;
  }

Input:
--------
God 
Is
Good

Output:(i want to get)
-----------------------------
God 
Is 
Good

Output: (i'm getting)
---------
Good
Good
Good
Please help me on this. Plzzz tell me where i'm doing the mistake. Is that logic totally wrong?? If that logic is completely wrong plzzz give me the correct solution.
Thanks .