+2 votes
in Mathematics by kratos

Give the output of the following?

void main()

{

char t1[10];

t1="craft";

printf("%*",t1);

}

a) craft

b) craf

c) Lvalue required

c) raft

1 Answer

+5 votes
by kratos
 
Best answer

Correct option: c) Lvalue required

Reason: t1 is an array. So you need to specify the subscript value while you assign any element to it. char t1; t1="craft" is correct since t1 is a pointer and it points to the starting add r.. of the craft.

...