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

  • Home
  • SEARCH
  • 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

Is there a library out there that can facilitate in creating assist or automated
I'm searching for a function that take an IPv6 address as argument and returns
I have the following replace function myString.replace(/\s\w(?=\s)/,$1\xA0); The aim is to take single-letter words
I'm writing a jQuery plugin, the main aim is to take a select element
I was wondering if there was a particular method that would allow me to
AIM : Convert a resultset to XML and assign the result to a variable
Aim The aim is to a have a container DIV with a fixed height
The aim is to create the documentation for my whole Visual Studio C# solution
My Aim: Sending an email (e.g. support request, error report) out of a C#
my aim is to invoke a shell script from a PHP program and then

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.