-
What will be the output of the following C code?
#include <stdio.h>
void main()
{
char *str = "SUJIT";
char *ptr = str * 5;
printf("%c\t%c", *ptr, str[3]);
}
-
- S I
- I S
- Garbage value
- Compilation Error
- None of these
Correct Option: D
Compilation Error
main.c: In function ‘main’:
main.c:5:25: error: invalid operands to binary * (have ‘char *’ and ‘int’)
char *ptr = str * 5;