Newbie to C Language... I've been core dumped

Sharky Forums


Results 1 to 2 of 2

Thread: Newbie to C Language... I've been core dumped

Threaded View

  1. #1
    Reef Shark
    Join Date
    May 2001
    Location
    Florida
    Posts
    421

    Newbie to C Language... I've been core dumped

    Hello everybody, I'm a programming newbie that needs some help. I'm working on an assignment for my C Language class and have the following code:

    Code:
    /*
     *  COP 3223
     *  Summer C 2002
     *  Call by Reference in a C Program
     *  June 24, 2002
     */
    
    #include <stdio.h>
    
    void read5(double *, double *, double *, double *, double *);
    
    int main(void) {
    
      double u, v, w, x, y;
    
      read5(&u, &v, &w, &x, &y);
    
      printf("%f%f%f%f%f", u, v, w, x, y);
    
      return 0;
    
    }
    
    void read5(double *i, double *j, double *k, double *l, double *m) {
    
      double temp1, temp2, temp3, temp4, temp5;
    
      scanf("%lf%lf%lf%lf%lf", temp1, temp2, temp3, temp4, temp5);
    
      *i = temp1;
      *j = temp2;
      *k = temp3;
      *l = temp4;
      *m = temp5;
    
    }
    I'm trying to write a function that takes five arguements of type pointer to double and reads 5 values from the key board. But when I try to compile this thingy I get core dumped after entering my five numbers. What the heffer did I do wrong? It looks good but works bad

    Any tips and hints to what I'm doing would be helpful, not trying to get you guys to do my homework, but I've been at this for a few hours and can't get this 'should be easy' function to work

    Thanks in advance
    Last edited by Handyman; 06-26-2002 at 10:11 PM.
    | Processor | Intel Pentium 4 @ 2800 MHz | Motherboard | ABIT IC7-Max3 | Memory | 2 GB Corsair XMS PC3200 DDR | Graphics | ATI Radeon 9800 Pro | OS/Prog HDD | W.D. Raptor 36GB (10k) SATA | Storage HDD | Seagate 160GB (7200) SATA | Burner | Lite-On 52x24x52 CDRW | DVD-ROM | Lite-On 16x DVD | Sound Card | Philips Acoustic Edge | Speakers | Klipsch ProMedia 2.1 | Flash Media | Lian-Li Flash Media Bay | Display | Dual NEC 22" Flat CRT | Case/PSU | Lian-Li PC-65B w/ Antec 430W | O.S. | MS Windows XP Pro | Printer | Epson Stylus Photo 2200

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •