Home » C Programming » Pointers

What will be the output of the program? #include #include int main() { int i, n; char *x="Alice"; n = strlen(x); *x = x[n]; for(i=0; i<=n; i++) { printf("%s ", x); x++; } printf("\n", x); return 0; }

Correct Answer: lice ice ce e

Explanation:

If you compile and execute this program in windows platform with Turbo C, it will give "lice ice ce e".


It may give different output in other platforms (depends upon compiler and machine). The online C compiler given in this site will give the Option C as output (it runs on Linux platform).


← Previous Question Next Question→

More Questions from Pointers

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion