Top

Discussion

Will the program compile?

#include
int main()
{
    char str[5] = "IndiaBIX";
    return 0;
}

 

  • A.True
  • B.False

Answer: A

C doesn't do array bounds checking at compile time, hence this compiles.

But, the modern compilers like Turbo C++ detects this as 'Error: Too many initializers'.

GCC would give you a warning.

No comment is present. Be the first to comment.
Loading…

Post your comment