Sunday, September 23, 2007

TECH QUES OF (9/23)

main()
{
int i, n;
char *x = "girl";
n = strlen(x);
*x = x[n];
for(i=0; i‹n; ++i)
{
printf("%s\n",x);
x++;
}
}

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. lengt of x is 5
    n=5
    *x=x[5]; implicitely *x refers to x[0]

    *x='\0' a blank space

    ten expected o/p is
    blank space
    g
    gi
    gir
    girl

    ReplyDelete