Subscribe to Get Free Material Updates!
Visit my new blog WebData Scraping - Web Scraping Service provider company in India.

Program to stuff the Byte After Specified Characters


#include<stdio.h>
#include<string.h>

int main()
{
        char str[20],str1[5][10];
        int i,j,len,no,n;
        printf("\n Enter message..\n");
        scanf("%s",str);
        printf("\n Enter no to byte stuffing..");
        scanf("%d",&n);
        no=0;
        len=strlen(str)/n;
        if(strlen(str)%n==0)
                len--;
        for(i=0;i<=len;i++)
        {
                str1[i][0]='*';
                str1[i][n+1]='*';
                for(j=1;j<=n;j++)
                {
                        if(no!=strlen(str))
                                str1[i][j]=str[no++];
                        else
                                str1[i][j]='#';
                }
        }
        for(i=0;i<=len;i++)
        {
                printf("\n Iteration : %d :",i+1);
                for(j=0;j<=n+1;j++)
                         printf("%c",str1[i][j]);
        }
        return 0;
}

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes