1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

not getting output

Discussion in 'C' started by vjkumar, Mar 11, 2012.

  1. vjkumar

    vjkumar New Member

    Joined:
    Mar 11, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    #include <stdio.h>

    int sum (int, int);

    int
    main (void)
    {
    int total;

    total = sum (2, 3);
    printf ("Total is %d\n", total);

    return 0;
    }

    int
    sum (int a, int b)
    {
    return a + b;
    }
    there's no error in this program but still not seeing output just a blank screen flashes.....
     
  2. Chong

    Chong New Member

    Joined:
    May 15, 2011
    Messages:
    29
    Likes Received:
    7
    Trophy Points:
    0
    Hi
    Execute the program in IDE or put getchar() at the end of the program. The DOS screen(?!) is at the moment outputing the result and closing at the end. That is why you see the flash.
    Best regards
    Chong
     
    vjkumar likes this.
  3. dearvivekkumar

    dearvivekkumar New Member

    Joined:
    Feb 21, 2012
    Messages:
    29
    Likes Received:
    5
    Trophy Points:
    0
    Which IDE are you using? If you are using Visual studio then run it by pressing "CTRL + F5"
    How are you trying to run the code?
    use getchar() just before the "return 0" statement
     
    vjkumar likes this.
  4. vjkumar

    vjkumar New Member

    Joined:
    Mar 11, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    guys thank u very much.....i'm kind of new in programming.....just mere begginner.....can u guys please tell me how can i learn the c strong.......the book i have lacks the bits and pieces.......and can i expect to interact with networks and websites with c.....?
     

Share This Page