What is the output ?

int main()
char a[10]=”HELLO”;
printf(“%d , %s”,strlen(a),s);
return 0;

a) 10 HELLO
b) 3 hye
c) 5 HELLO
d) Error

Answer : (d)

Explanation :

Non-portable pointer conversion : When you will assign any value to a pointer variable then compiler will automatically convert  given value in address  of pointer type such automatic type conversion is known as non-portable pointer conversion. For this compiler shows an error message or warning.

Here Non-portable pointer conversion occurs at assignment a[10]=”hye”.

Leave a Reply

Your email address will not be published. Required fields are marked *