Examveda

What will be the output of the following C code?
#include <stdio.h>
#include <string.h>
int main()
{
    char *str = "x";
    char c = 'x';
    char ary[1];
    ary[0] = c;
    printf("%d %d", strlen(str), strlen(ary));
    return 0;
}

A. 1 1

B. 2 1

C. 2 2

D. 1 (undefined value)

Answer: Option D


This Question Belongs to C Program >> C Fundamentals

Join The Discussion

Related Questions on C Fundamentals