B
Bill Cunningham
I've read that the only parameters that main takes other than a void is this
main(int argc,char *argv[])
I may be correct on this.
I want to take from the command line prompt 2 doubles, pass the values
stored in the array to another function which does some calculations and
returns the address of doubles to the main function.
rel.c /* name of source */
#include "main.h"
main.h reads as thus...
#include <stdio.h>
#include <math.h>
double relstr(double *p1,double *p2);
/* first line of rel.c */
main(int argc,char *argv[])
{if (argc!=2) {puts("command error"); exit(1);}
sscanf(argc,"%s",argv[1]);
double *p1=argv[0];
double *p2=argv[1];
I'm not quite sure what to return here and I've tried to compile this code
in many forms. I always get an error with parameter 1 of sscanf(). Should
the be a cast to a type or pointer to or from a type somewhere?
Bill
main(int argc,char *argv[])
I may be correct on this.
I want to take from the command line prompt 2 doubles, pass the values
stored in the array to another function which does some calculations and
returns the address of doubles to the main function.
rel.c /* name of source */
#include "main.h"
main.h reads as thus...
#include <stdio.h>
#include <math.h>
double relstr(double *p1,double *p2);
/* first line of rel.c */
main(int argc,char *argv[])
{if (argc!=2) {puts("command error"); exit(1);}
sscanf(argc,"%s",argv[1]);
double *p1=argv[0];
double *p2=argv[1];
I'm not quite sure what to return here and I've tried to compile this code
in many forms. I always get an error with parameter 1 of sscanf(). Should
the be a cast to a type or pointer to or from a type somewhere?
Bill