Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 920671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:45:18+00:00 2026-05-15T18:45:18+00:00

My aim is to take two strings and compare there ends if both of

  • 0

My aim is to take two strings and compare there ends if both of them ends with “ing”,”ed” or there ends do not match.It always says that strings do not match .

#include <stdio.h>
#include <conio.h>
#include <string.h>
int ised(char str[]);
int ising(char str[]);

int  main()
{
    char str1[30],str2[30];
    printf("Enter 1st string:\n");
    gets(str1);
    printf("Enter 2nd string:\n");
    gets(str2);
    if((ising(str1))||(ised(str1))||(ising(str2))||(ised(str2)))
    {
        if(ising(str1)&&ising(str2))
        {
            printf("Both strings end with ing");
        }
        else if(ised(str1)&&ised(str2))
        {
        printf("Both strings end with ed");
        }
        else
        printf("Both strings ending do not match");
    }
    else
    printf("One or both strings do not end with ing or ed.Program Quitting...");
    getch();
    return 0;
}
int ising(char str[])
{
    int len,flag=0;
    len=strlen(str);

        if (!(strncpy(&str[len-3],"ing",3)))
                flag=1;
        else
        flag=0; 
return flag;           
}
int ised(char str[])
{
    int len,flag=0;
    len=strlen(str);

        if( !(strncpy(&str[len-2],"ed",2)) )
                flag=1;
        else
        flag=0; 
return flag;           
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:45:19+00:00Added an answer on May 15, 2026 at 6:45 pm

    You are using strncpy which does string copying, if you want to compare strings, use strncmp.

    See: strncpy
    and strncmp

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SVN and CVS are two very different systems that aim to address the same
Does anyone know of any existing projects that aim to port Android's Java VM
Should we aim for DRY, in the sense that changes to the functionality affect
I have the following replace function myString.replace(/\s\w(?=\s)/,$1\xA0); The aim is to take single-letter words
My Aim: Sending an email (e.g. support request, error report) out of a C#
I'm trying to find any JavaScript frameworks whose sole aim is to standardize the
When developing a new web based application which version of html should you aim
I am developing a system as an aid to musicians performing transcription. The aim
EDIT: This peace of code is pretty fine (so take it as example of
I am attempting to write (or expand on an existing) graph search algorithm that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.