#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    1
    Rep Power
    0

    Question about simple c programming methods


    this is my first attempt on methods and im new for c programming.im using the Cygwin compiler and here's what i did

    Code:
    # include <stdio.h>
    
    int add(int x,int y)
    {
        int result =x+y;
        return result;
    
    }
    
    int main()
    {
    
        int sum=add(5,12);
        printf("The addition of 5 and 12 is %d.\n", sum);
        //printf(sum);
        return 0;
    }
    I used netbeans 7.2 and compiled it using cygwin and im getting an error.any idea will be really helpful the file i saved is add.c
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,367
    Rep Power
    1870
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2010
    Posts
    67
    Rep Power
    0
    what is the error you get please specify

IMN logo majestic logo threadwatch logo seochat tools logo