如何声明包含C数组的C数组?

时间:2016-03-09 12:52:43

标签: c arrays

鉴于声明数组的简短表示法,如何指定myArray的类型为数组?

[] myArray = {   //here [] should be array type
            {"obj1, "obj2"},        
            {"obj1, "obj2"}
}

1 个答案:

答案 0 :(得分:1)

假设你想要一个二维的字符串数组:

const char *myArray[][2] = {
        {"obj1", "obj2"},        
        {"obj1", "obj2"}
        /* any other elements */
};