Thread: where is my wrong in function in function

  1. #1
    Registered User
    Join Date
    Mar 2014
    Posts
    95

    where is my wrong in function in function

    i want to check geo_analyzer using by check_line and check_triangle thank you for appreciated answers

    Code:
    double calculateSlop(double a,double b,double c,double d){
    
        return (d-c)/(b-a); // like (y2-y1)/(x2-x1)
    }
    
    int geo_analyzer( double p1_x, double p1_y, double p2_x, double
        p2_y, double p3_x, double p3_y, double p4_x, double p4_y){
    
            double m1,m2,m3;
    
            m1=calculateSlop(p1_x,p2_x,p1_y,p2_y);
            m2=calculateSlop(p2_x,p3_x,p2_y,p3_y);
            m3=calculateSlop(p3_x,p4_x,p3_y,p4_y);
    
            if(check_line==1){
            return 1; // line
            }
            if(check_triangle==1){
            return 2; //triangle
        }
    }
    
    }
    Last edited by Ph0x; 09-29-2014 at 09:38 AM.

  2. #2
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    528
    What exactly is your problem, what is not working as it is supposed to?

  3. #3
    Registered User
    Join Date
    Mar 2014
    Posts
    95
    Quote Originally Posted by Aslaville View Post
    What exactly is your problem, what is not working as it is supposed to?
    i get the error /home/soner/Untitled1.c|60|warning: comparison between pointer and integer [enabled by default]|
    Code:
     if(check_line==1){       
    return 1; // line
         
            if(check_triangle==1)
            return 2; //triangle

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    [edit]never mind - wasn't paying attention[/edit]
    Last edited by Elkvis; 09-29-2014 at 09:31 AM.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  5. #5
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    528
    If you want to call function 'check_line' and 'check_triange' you have to do it like:

    Code:
    if ((check_line(/* insert your arguments here*/ ) == 1)) {
     
        /* blah blah blah */
    
    }
    Last edited by Aslaville; 09-29-2014 at 09:29 AM.

  6. #6
    Registered User
    Join Date
    Mar 2014
    Posts
    95
    Quote Originally Posted by Aslaville View Post
    If you want to call function 'check_line' and 'check_triange' you have to do it like:

    Code:
    if ((check_line(/* insert your arguments here*/ ) == 1)) {
     
        /* blah blah blah */
    
    }
    thank you

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. what's wrong with this if function
    By suryak in forum C Programming
    Replies: 2
    Last Post: 08-13-2011, 12:07 PM
  2. What's wrong with this function ?
    By johngav in forum C Programming
    Replies: 22
    Last Post: 06-24-2009, 12:09 PM
  3. What is wrong with this function?
    By shardin in forum C Programming
    Replies: 20
    Last Post: 09-24-2007, 01:50 PM
  4. What is wrong with my function?
    By s0beit in forum C++ Programming
    Replies: 6
    Last Post: 12-14-2006, 11:57 PM
  5. Something wrong with my function!?
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 02-02-2002, 08:29 AM