0

Why i didn't get the output for this c program in arrays?

#include<stdio.h> int main() { long long int n,a[n]; int i; for(i=0;i<n;i++) { printf("enter the element for index number:=%d\n",i); scanf("%lld",&a[i]); } for(i=0;i<n;i++) { printf("The element at index %d=%lld\n",i,a[i]); } return 0; }

8th Feb 2022, 8:33 AM
Rajulapudi Aswini
Rajulapudi Aswini - avatar
8 Answers
+ 3
Rajulapudi Aswini Where did you take input n?
8th Feb 2022, 8:38 AM
A͢J
A͢J - avatar
+ 2
Rajulapudi Aswini long long int n; scanf ("%lld", &n); long long int a[n];
8th Feb 2022, 8:48 AM
A͢J
A͢J - avatar
+ 2
Rajulapudi Aswini Update your code and take input like this: 2 //which is number of elements 2 3 And above are two elements
8th Feb 2022, 1:39 PM
A͢J
A͢J - avatar
0
I code for infinite number of inpuuts..So i called it as n
8th Feb 2022, 8:42 AM
Rajulapudi Aswini
Rajulapudi Aswini - avatar
0
Can you make a code for n inputs and explain?
8th Feb 2022, 8:44 AM
Rajulapudi Aswini
Rajulapudi Aswini - avatar
0
Thank you,But i didn't get the output.
8th Feb 2022, 8:52 AM
Rajulapudi Aswini
Rajulapudi Aswini - avatar
0
Please put C-Language in the tags above ☝
8th Feb 2022, 12:36 PM
Ipang