CrazyEngineers
  • brain teaser

    Updated: Oct 26, 2024
    Views: 1.0K
    main()
    {
    char thought[2][30]={"Don't walk infront me..","i am not follow"};
    printf("%c%c",*(thought[0]9),*(*(thought 0)5));
    }
    What will be the output of this code???
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • anandkumarjha

    MemberOct 4, 2010

    what will be the output of the following codes any why????please explain....
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    printf("%d",printf("%d %d",2,2)& printf("%d %d",2,2));
    getch();
    }




    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    printf("%d",printf("%d %d",2,2)& printf("%d %d",2,2));
    getch();
    }
    although thay look like same but they different from each other
    Are you sure? This action cannot be undone.
    Cancel
  • sam_from_hell

    MemberOct 4, 2010

    anandkumarjha
    main()
    {
    char thought[2][30]={"Don't walk infront me..","i am not follow"};
    printf("%c%c",*(thought[0]9),*(*(thought 0)5));
    }
    What will be the output of this code???
    Its throwing up a error "Expected ')' before numeric constant"
    Are you sure? This action cannot be undone.
    Cancel
  • silverscorpion

    MemberOct 5, 2010

    anandkumarjha
    what will be the output of the following codes any why????please explain....
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    printf("%d",printf("%d %d",2,2)& printf("%d %d",2,2));
    getch();
    }




    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    printf("%d",printf("%d %d",2,2)& printf("%d %d",2,2));
    getch();
    }
    although thay look like same but they different from each other
    I dont see any difference between the first and the second.. I think both are one and the same..

    Anyhow, for the first program, the output is,

    2 2 2 2 1

    There are 2 printf statements inside the main printf statement.. printf statement returns the number of characters it has sent to the output buffer..
    So, both the inner printf's will return 2. It becomes '2 & 2' which is 1. So, 1 is printed last..
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register