What would be the output of this program.

Discussion in 'Programmer's Corner' started by dileepchacko, Jul 30, 2008.

  1. dileepchacko

    Thread Starter Active Member

    May 13, 2008
    102
    1
    Hi All


    What would be the output of this program.


    main( )
    {
    struct employee
    {
    char name[25] ;
    int age ;
    float bs ;
    } ;
    struct employee e ;
    strcpy ( e.name, "Hacker" ) ;
    age = 25 ;
    printf ( "\n%s %d", e.name, age ) ;
    }





    -- Best RegardsDileep Chacko
     
  2. Mark44

    Well-Known Member

    Nov 26, 2007
    626
    1
    Why don't you compile it and see for yourself?

    BTW, it isn't complete. One thing that's missing is a preprocessor #include directive for the headers that contain the declarations for printf and strcpy.
     
    Last edited: Jul 30, 2008
  3. CVMichael

    Senior Member

    Aug 3, 2007
    416
    17
    age is not declared, I think you wanted to have:

    e.age = 25;
    printf ( "\n%s %d", e.name, e.age ) ;
     
Loading...