cethint cethint - 11 months ago 66
C Question

How to declare string array in c


int main()
int i;
string A[]={"Ahmet", "Mehmet", "Bulent", "Fuat"};

return 0;

How can i see my array's elements as output?

Compiler says "'string' undeclared".

Answer Source

This way:

 char *A[] = {"Ahmet", "Mehmet", "Bülent", "Fuat"};

A is an array of pointers to char.