Solved programming problem

Remove a Position from a String in C.

Source code

#include<stdio.h>

int main()

{

    char str[100], strn[100];

    int i,n;

   

    printf("Enter a string: ");

    gets(str);

    printf("Enter a position: ");

    scanf("%d",&n);

    i=0;

    while(i!=n)

    {

        i++; /// counting the i value until n

    }

    while(str[i]!='�')

    {

        str[i]=str[i+1]; /// saving all character after n as +1

        i++;

    }

    printf(" Your New String: %s",str);

    return 0;

}

Output

Enter a string: haven

Enter a position: 3

Your New String:havn

Join the discussion

Add your comment

1 previous comment

sanjida

why do we use ? mark in the string......