help me for this array pointer

plis somebody help me, i have this code, but i dont know what the next code to find a word from the array A B C D E... plis help meeee

#include <iostream>
using namespace std;
int main() {
char A[] = {'A','K','I','C','R'};
char B[] = {'N','O','N','A','U'};
char C[] = {'D','T','D','A','M'};
char D[] = {'A','A','A','C','U'};
char E[] = {'P','X','H','U','S'};

char *p[]={A,B,C,D,E};
char kata;

cout<<"Input kata : ";
cin>>kata;

cout<< sizeof(*p)<<endl;
cout<<sizeof(int)<<endl;
for (int i=0;i<5; i++) {
cout<<*(*(p+i));
}
return 0;
}
If we take array B for example. You have 5 letters in it, making the array of size 5.

Which means, that the letters are placed between indexes 0-4. Because arrays always start at 0.

If you want, to reach the last letter of Array B, you just do B[4];

Just a helpful tip for the future. If you need help with something very basic such as how arrays works, look it up on google before asking on forums, or look it up on youtube, there are tons and tons of content all over the place explaining very well how things like this works.


Here are some great videos on basics of c++.

https://www.youtube.com/playlist?list=PLAE85DE8440AA6B83
Last edited on
Topic archived. No new replies allowed.