Click to See Complete Forum and Search --> : Newbie to C Language... I've been core dumped


Handyman
06-26-2002, 10:09 PM
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:



/*
* 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

Handyman
06-26-2002, 10:29 PM
Ok I was dumb... I forgot the darn & symbol in the scanf function... :p

I works dandy now :)