storing elements in an array

0 divy satyam · August 28, 2015
#include<stdio.h>
#include<conio.h>

int main()
{int n,a,i=0,arr[50];
printf("enter the number of values");
scanf("%d",&n);

for(i=0;i<=n;i++)
{scanf("%d",&a);
arr=a;
i++;
}
printf("%d",arr);
  getch();
  return 0;
    
    
    }
i want to store some elements in an array.but it is not working.point out the errors.

Post a Reply

Replies

Oldest  Newest  Rating
0 Sha Kal · August 28, 2015
int main(){

int n, i, arr[50];

printf("Enter the number of values");
scanf("%d",&n);

for (i=0; i<n; i++){

scanf("%d",&arr);
}

for (i=0; i<n; i++){
printf("%d",array);
}

return 0;
}
0 Franz Schmidt · August 29, 2015
Please post your code on an external site like: http://textuploader.com/
The forum of tnb is a little buggy due to bb-codes which are used to style text inside a forum post.
  • 1

C

107,124 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator