beginner : help

This is a discussion on beginner : help within the C Programming forums, part of the General Programming Boards category; hi i have been doing a few tutorials teaching my self c, i have tried to experiment with one of ...

  1. #1
    Registered User
    Join Date
    Feb 2009

    beginner : help

    i have been doing a few tutorials teaching my self c, i have tried to experiment with one of the exercises i have done but the out come isnt what i want. this is my source code:

    #include <stdio.h>
     main ()
          int total; 
          int a,b;
        printf("enter number:" ,&a);
        printf("enter 2nd number:" ,&b);
        total = a + b;
         printf(" the number is %d " ,total );
    return 0;
    i want the the program so i can enter 2 numbers and it to display the sum of those two numbers. what is hapenning when i execute the program tho is, i can enter the two numbers but after that, the cmd prompt screen disappears.

    can any one help me??

    also any good links to web sites with more exercise to do wud be appreciated


  2. #2
    Registered User
    Join Date
    May 2008

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    segmentation fault
    You know what they say about horseshoes and handgrenades??? Well it usually won't apply with C (even worse: sometimes it does).

    But good try. You have something backward, I don't know what you were thinking but this is what should be:
       printf("enter number:");
       printf("enter 2nd number:");
    See the difference?
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    Registered User
    Join Date
    Feb 2009


    lol thanks, i feel like a ryt idiot now hahahaha

    cheers 4 the help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Same old beginner question...
    By Sharmz in forum C Programming
    Replies: 15
    Last Post: 08-04-2008, 11:48 AM
  2. What are some good beginner programs I shouold make?
    By oobootsy1 in forum C# Programming
    Replies: 6
    Last Post: 08-09-2005, 02:02 PM
  3. Books, Beginner, MustHave
    By Zeusbwr in forum C++ Programming
    Replies: 9
    Last Post: 10-25-2004, 05:14 PM
  4. Windows programming for beginner (Absolute beginner)
    By WDT in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2004, 10:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21