(11) What will be output if you will compile and execute the following c code?
void main(){
char *str="c-pointer";
printf("%*.*s",10,7,str);
}
(a) c-pointer
(b) c-pointer
(c) c-point
(d) cpointer null null
(e) c-point
Answer: (e)
Explanation:
Meaning of %*.*s in the printf function:
First * indicates the width i.e. how many spaces will take to print the string and second * indicates how many characters will print of any string.
Following figure illustrates output of above code: