#include<stdio.h>
#define SIZE 10
int main(){
int i;
double array_1[SIZE]; // array declaration
for(i=0;i<SIZE;i ) // enter array elements
scanf(" %lf,array_1[i]");
printf("\n%s\n","---------------------");
// printf("%s\t%s\n","S.No","Elements");
for(i=0;i<SIZE;i ) // print array elements
printf("=\t%lf\n",i 1,array_1[i]);
}
scanf function accepting values for index value 0, subsequently it interrupts abruptly.
CodePudding user response:
You have to add &
for reading value
for(i=0;i<SIZE;i ) scanf("%lf", &array_1[i]);
CodePudding user response:
for(i=0;i<SIZE;i ) // enter array elements
scanf(" %lf,array_1[i]");
Here you told the program that you want to read a value that is followed by ",array_1[i]" you have to close the " after %lf and specify the variable as an argument try
for(i=0;i<SIZE;i ) // enter array elements
scanf(" %lf", &array_1[i]);