adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Program in C to delete a Character from a given position in a given string

Program in C to delete a Character from a given position in a given string







➤Program Code


#include<stdio.h>
#include<string.h>
 int main()
  {
   char str[100];
   int position,i,length=0;
   printf("Enter a string:-");
   scanf("%s",str);
   printf("Enter the position from where you want to delete a character:-");
   scanf("%d",&position);
   printf("Before deletion  = %s\n",str);
   length=strlen(str);
   for(i=position-1;i<length;i++)
        str[i]=str[i+1];
       printf("After deletion  = %s\n",str); 
    return 0;
  }
Output:-








Related Programs

  1.   Program in C to insert a character in string at given position

Post a Comment

0 Comments