Search code examples
carrayscompiler-errorsdeclarationdeclare

error in c language when trying to declare array of strings


I am trying to declare this array of strings(or a 2d character array,i reckon) in c language but the compiler ide is giving me error: "[Error] array type has incomplete element type"

char division[][]={"Northeast Division","Northwest Division","Southeast Division","Southwest Division"};

what am I doing wrong?


Solution

  • You have to specify the maximum length of a string. This should solve your problem

    char division[][25]={"Northeast Division","Northwest Division","Southeast Division","Southwest Division"};