URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       techsuns
  HTML https://techsuns.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: OutPut of a Program
       *****************************************************
       #Post#: 375--------------------------------------------------
       What does this program give as output
       By: kranthipls Date: December 7, 2012, 11:57 pm
       ---------------------------------------------------------
       What does the below program outputs????????????
       g( )
       {
       static int x[1024];
       return x;
       }
       main( )
       {
       char *g1="FIRST STRING";
       strcpy(g( ),g1);
       g1=g( );
       strcpy(g1,"SECOND STRING");
       printf("%s",g( ) );
       }
       #Post#: 377--------------------------------------------------
       Re: What does this program give as output
       By: dinesh Date: December 8, 2012, 9:12 am
       ---------------------------------------------------------
       what is the return type of g()?
       #Post#: 381--------------------------------------------------
       Re: What does this program give as output
       By: kranthipls Date: December 10, 2012, 3:52 am
       ---------------------------------------------------------
       You will not be told all that.............
       Just go by the C definitions and tell what's going to come
       #Post#: 385--------------------------------------------------
       Re: What does this program give as output
       By: kpr29 Date: December 10, 2012, 11:04 am
       ---------------------------------------------------------
       @Kranthi: Output: SECOND STRING
       kp.
       #Post#: 393--------------------------------------------------
       Re: What does this program give as output
       By: satya Date: December 10, 2012, 10:23 pm
       ---------------------------------------------------------
       i executed and saw that SECOND STRING is the output...  is it
       because x is a static variable in the function g()  and the
       pointer is pointing to SECOND STRING ?  ???
       *****************************************************