Computer Science, asked by hranjan923, 9 months ago

the output of program is? char p[20]; char*s="string"; int length=strlen(s); int i; for(i=0;i<length;I++) p[i]=s[length of-i]; printf("%s",p) ;​

Answers

Answered by knowledgecentre59
3

Answer:

This program won't produce any output.

Explanation:

For instance, consider the for loop statement:

p[i] = s[length — i];

For i = 0, p[i] will be s[6 — 0] and s[6] is ‘Null or \0’

So p[0] will become ‘\0’ in this case, since it doesn’t matter what comes next like p[1], p[2], etc. Since, P[0] will not change it's value for i >0. There won't be any output, if we print a string with first character ‘\0’.

Hope you understood the concept.

Similar questions