Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to insert an element at the specified
position in the given array in c language

Answer Posted / ashok kannan

Hi to all,

/* program to insert element in the array at given
position*/
#include<stdio.h>
#include<conio.h>
void main()
{
char c,t2,t1,a[100]="This is c program";
int n,i;

printf("Enter the position and the element\n");
scanf("%d%c",&n,c);

for(i=n,t1=a[i];a[i]!='\0';i++)
{
t2=a[i+1];
a[i+1]=t1;
t1=t2;
}
a[n]=c;

printf("%s",a);
getch();

}

Is This Answer Correct ?    19 Yes 46 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you know about the use of bit field?

990


What is the purpose of clrscr () printf () and getch ()?

1025


How variables are declared in c?

995


.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }

2506


Explain what is the difference between a string and an array?

1104


How to get string length of given string in c?

1014


What are examples of structures?

1029


What does node * mean?

1146


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

1327


Give the rules for variable declaration?

1118


What are the properties of union in c?

997


Why doesnt that code work?

1078


What is the method to save data in stack data structure type?

1037


What is a memory leak? How to avoid it?

1262


How can I pad a string to a known length?

971