This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

about an error

sir,
when i am doing 3d array initialization as following:
unsigned char keypad[4][4][0] =('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
then its not showing any error.
but when i use following line:
unsigned char keypad[4][4][0] ={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
then compiler showing the error that there is some error near "{"
so can you please resolve my problem....?

Parents
  • 1) Now you suddenly don't have any three-dimensional arrays anymore with the innermost index having size zero.

    2) Did you indent your code with tab (with seldom works when posting code on a web forum) or don't you intent your code at all?

    3) Last line is "error C141". That is not a complete error message. A complete error message would also contain a descriptive text, a file name and a line number. And that line number should be marked in the full source code since we don't have any text editor letting us find a specific line without having to manually count.

    4) Why do you attempt to assign a full set of array data to your matrix inside main(), and after the matrices was created? Do you really think that the operator "=" can assign multiple array indices in a single assign? You want to perform everything in the same step when creating the matrix. So something like:

    const unsigned char keypad0[4][4] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
    

    When you try to assign to an array at runtime, you have two options. Either you assign one entry at a time - which may involve a for loop for stepping through the index values. Or you perform a memcpy() to copy raw data from another array of compatible element type (but potentially with different number of dimensions and size of the individual dimensions).

Reply
  • 1) Now you suddenly don't have any three-dimensional arrays anymore with the innermost index having size zero.

    2) Did you indent your code with tab (with seldom works when posting code on a web forum) or don't you intent your code at all?

    3) Last line is "error C141". That is not a complete error message. A complete error message would also contain a descriptive text, a file name and a line number. And that line number should be marked in the full source code since we don't have any text editor letting us find a specific line without having to manually count.

    4) Why do you attempt to assign a full set of array data to your matrix inside main(), and after the matrices was created? Do you really think that the operator "=" can assign multiple array indices in a single assign? You want to perform everything in the same step when creating the matrix. So something like:

    const unsigned char keypad0[4][4] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
    

    When you try to assign to an array at runtime, you have two options. Either you assign one entry at a time - which may involve a for loop for stepping through the index values. Or you perform a memcpy() to copy raw data from another array of compatible element type (but potentially with different number of dimensions and size of the individual dimensions).

Children