Home / General Knowledge / Testing New :: Discussion

Discussion :: Testing New

  1. Determine Output:

    void main()

    {

    char *p="hi friends", *p1;

    p1=p;

    while(*p!='\0') ++*p++;

    printf("%s", p1);

    }

  2. A.

     hi friends

    B.

     ij!gsjfoet

    C.

     hj grjeodt

    D.

     None of These

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    ++*p++ will be parse in the given order :
    1. *p that is value at the location currently pointed by p will be taken
    2. ++*p the retrieved value will be incremented
    3. when ; is encountered the location will be incremented that is p++ will be executed.


Be The First To Comment