if i have a 2D array
int A[3][2] = { {3,4}, {5,6}, {0,-5} }
what will be the result if I try to print the element A[1]? will it be garbage value? or will it become a logical error?
Assuming you do something like
printf("%d\n", A[1]);
then that will be undefined behavior. That's because the array A[1] will decay to a pointer to its first element (i.e. in that context A[1] will decay to &A[1][0]), and the %d format specifier is wrong for printing pointers.
However
printf("%p\n", (void *) A[1]);
will be perfectly fine, as %p is the correct format specifier to print void * pointers.
And as noted in a comment, just because you have undefined behavior that doesn't mean the program will crash or result it "garbage" (even though the (possibly truncated) pointer might look like that when printed as a decimal integer).
Ais an array of arrays ofint. SoA[1]is an array (of twointvalues). If the compiler will complain or if it's a logical error depends on the context, what you do with the array.