Hey all! i m new to dynamic arrays and pointers... can any one explain me the error??
Code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
//-- inputarray defi --
void inputarray(int size, double* array){
array=(double *)malloc(size*sizeof(double));
int a=0;
for(; a<size; a++){
scanf("%lf",(array+a));
}
}
// ** inputarray end **
//-- printarray defi --
void printarray(int size, double* array){
array=(double *)malloc(size*sizeof(double));
int a=0;
for(; a<size; a++){
print("%lf",(array+a));
}
}
// ** printarray end **
//-- main --
int main()
{
int* arr1, arr2;
int size1,size2;
printf("Enter the size of aray 1: ");
scanf("%d",&size1);
inputarray(*arr1,size1);
printarray(*arr1,size);
return 0;
}
//** main end **
Error:
36 C:\Users\Administrator\Desktop\ass 6\2.c [Warning] passing arg 2 of `inputarray' makes pointer from integer without a cast