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 4532810
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:04:37+00:00 2026-05-21T14:04:37+00:00

int sum_s1=0, sum_s2=0; int comps(char s1[], char s2[]) { if (s1[0] == ‘\0’ &&

  • 0
int sum_s1=0, sum_s2=0;

int comps(char s1[], char s2[]) {

  if (s1[0] == '\0' && s2[0] == '\0') {

     if (sum_s1 == sum_s2) {
       printf("hihi"); //printable
       return 1;  //return the 4202692

     } else {
       return 0;
     }

  } else {

    if (*s1 != '\0') {

       if (s1[0]!=32) {
         sum_s1 += s1[0];

       } else {
         sum_s1 += 0;

       }
       *s1 = *(s1+1);
    } 
    if (*s2 != '\0') {

       if (s2[0]!=32) {
         sum_s2 += s2[0];

       } else {
         sum_s2 += 0;

       }

      *s2 = *(s2+1);
    } 

      if (*s1 != '\0' && *s2 == '\0') equalIgnoreSpace(s1+1, "\0");
      if (*s1 == '\0' && *s2 != '\0') equalIgnoreSpace("\0", s2+1);
      if (*s1 != '\0' && *s2 != '\0') equalIgnoreSpace(s1+1, s2+1);
      if (*s1 == '\0' && *s2 == '\0') equalIgnoreSpace("\0", "\0");
  }
}

int main() {

  int compa=1;


  compa = comps("abc f", "abcf");
  printf("%d", compa);  //return the 4202692


  if (compa == 1) {
     printf("Two string are equal");
  } else {
     printf("Two string are not equal");
  }

  getchar();
  return 0;
}

comps() should return 1 and stop, but I can’t get 1 in main function. How can I fix this?

  • 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-21T14:04:37+00:00Added an answer on May 21, 2026 at 2:04 pm

    there is no return statement in the comps function [in else case]

    int comps(char s1[], char s2[]) 
    {
      if (s1[0] == '\0' && s2[0] == '\0') 
     {
         if (sum_s1 == sum_s2) 
         {
           printf("hihi"); //printable
           return 1;  //return the 4202692
         }
         else 
           return 0;
      }
     else
     {
      ...
      ...
      return code;
     }   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

int x; printf(hello %n World\n, &x); printf(%d\n, x);
int main(void) { char tmp, arr[100]; int i, k; printf(Enter a string: ); scanf_s(%s,
int somefunction(bool a) { try { if(a) throw Error(msg); return 2; } catch (Error
#include <stdio.h> void main(void) { int a; int result; int sum = 0; printf(Enter
private void sumNode(TNode node) { int sum = 0; if (node == null) return;
Where in memory are return values stored in memory? Consider the follwing code: int
here's the code: class Acount { int sum ; String owner ; //these seem
How can the following simple implementation of sum be faster? private long sum( int
int x = n / 3; // <-- make this faster // for instance
int[] mylist = { 2, 4, 5 }; IEnumerable<int> list1 = mylist; list1.ToList().Add(1); //

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.