الأحد، 5 يناير 2014

modular and flexible programming

I am trying to learn how to make a modular program. So what I want to do is read an array of integers. Main:

#include #include #define NMAX 10void read (int *n, int a[NMAX]);int main(){ int n, a[NMAX]; read(&n,a); return 0;}

Then I saved this file 'read.cpp':

#include #include #define NMAX 10void read (int *n, int a[NMAX]){ int i; printf("dati n:\n"); scanf("%d",n); for (i=1;i<=*n;i++) { printf("a[%d]= ",i); scanf("%d\n",&a[i]); }}

read.cpp compiles succesfully, but when I compile the main function I get the error "no reference to read".


View the original article here

ليست هناك تعليقات:

إرسال تعليق