Thread: pointer

  1. #1
    Registered User
    Join Date
    Feb 2018
    Posts
    24

    pointer

    Code:
    #include <stdio.h>
    
    void order(double *smp,double lgp){
        double temp;
        if(*smp > *lgp){
                temp=*smp;
                *smp=*lgp;
                *lgp=temp;    
        }
     }
    int main () {
    
        double num1,num2,num3;
        printf("enter three number seperated by blanks");
        scanf("%lf%lf%lf",&num1,&num2,&num3);
        
        return 0;
    }

    hey all
    i am taking error at 5.line can anyone fix the problem?

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Code:
    void order(double *smp,double lgp){
    lgp is declared as a double not a pointer to double.

    Tim S.
    Last edited by stahta01; 02-09-2018 at 10:19 AM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    Registered User
    Join Date
    Feb 2018
    Posts
    24
    Quote Originally Posted by stahta01 View Post
    Code:
    void order(double *smp,double lgp){
    lgp is declared as a double not a pointer to double.

    Tim S.
    thank you for your attention

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 08-18-2015, 03:13 PM
  2. Replies: 8
    Last Post: 03-01-2015, 12:39 AM
  3. Replies: 3
    Last Post: 03-27-2014, 12:10 AM
  4. Replies: 3
    Last Post: 10-30-2009, 04:41 PM
  5. Replies: 4
    Last Post: 08-27-2007, 11:51 PM

Tags for this Thread