I have got a question. When a user enters a number, it will automatically be prepared to get that amount of variables.
Exp:
Enter numbers to process:3
Enter number:1.2
Enter number:17
Enter number:12
thanks.
I have got a question. When a user enters a number, it will automatically be prepared to get that amount of variables.
Exp:
Enter numbers to process:3
Enter number:1.2
Enter number:17
Enter number:12
thanks.
So you read a value into say n
Then do
for ( i = 0 ; i < n ; i++ )
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
You also have to allocate some memory for vars:Code:#include <stdlib.h> // Some crap int n, i; double *dTbl; scanf("%d", &n); dTbl = malloc(n*sizeof(*dTbl)); for (i = 0; i < n; i++) scanf("%f", dTbl[i]); // TODO: Do something with your numbers free(dTbl); // Remember to free allocated memory