cethint cethint - 1 year ago 116
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download