0
please guys can anyone of you tell me where is the problem in this code
#include<stdio.h> int main(){ int N ,i ,P,position,value ; int T[50]; printf("Enter number of elements in the array \n"); scanf("%d",&N); for(i=0;i<N;i++){ P=T[i]; printf("enter the values of elements T[%d]=\n",i); scanf("%d",&P); printf("T[%d]=%d\n",i,P);} printf("Please enter the location where you want to insert an new element "); scanf("%d",&position); printf("\n please enter the value "); scanf("%d",&value); for(i=N-1;i>=position-1;i--){ T[i+1]=T[i]; T[position-1]=value;} for(i=0;i<=N;i++){ printf("%d\n",T[i]);} }
6 Answers
+ 1
See the notes in the edited code
https://code.sololearn.com/cto4952ZhCX7/?ref=app
+ 2
Thanks
+ 1
Please save the code in SoloLearn and share the code link instead of raw text like this. It is uneasy to work with, and it's hard to point line numbers.
Follow this guide to sharing links 👍
https://www.sololearn.com/post/75089/?ref=app
+ 1
So you want to fill 50 elements in array, then insert 1 new value to replace an existing element; is this what you want or am I misunderstanding?
0
Thanks
0
Yes that's what I want



