About the complier

Discussion in 'C' started by wdliming, Oct 16, 2010.

  1. wdliming

    wdliming New Member

    Joined:
    Sep 26, 2010
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    0
    Rcently,i come across a problem,i wrote a code as following:
    Code:
    #include <stdio.h>
    //#include <stdlib.h>
    void ex(int &a,int &b)
    {
     int  t;
     t = a;
     a = b;
     b = t;
    }
    int main()
    {
     int a,b;
     a = 1;
     b = 2;
     printf("%d%d\n",a,b);
     ex(a,b);
     printf("%d%d\n",a,b);
        //printf("Hello world!\n");
        return 0;
    }
    but when i copy it into codeblocks and wDEV c++,then i rebuild it ,it could not success,but when i rebuild it in c-free,it works!~~nothing wrong.
    could someone tell me why?
    Thank you !
     
    Last edited by a moderator: Oct 16, 2010
  2. jimblumberg

    jimblumberg New Member

    Joined:
    May 30, 2010
    Messages:
    120
    Likes Received:
    29
    Trophy Points:
    0

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice