Multiple choice technology programming languages

What will be the output of the following program : void main() { char str[]="C For Swimmers"; printf("%d",sizeof str); }

  1. 14

  2. Compile-Time Error

  3. 15

  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

sizeof returns the size in bytes, including the null terminator. 'C For Swimmers' has 14 characters plus 1 null terminator = 15 bytes. sizeof str is evaluated at compile time as 15.