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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:05:17+00:00 2026-05-30T03:05:17+00:00

i have the following problems in C programming. I have an array of strings

  • 0

i have the following problems in C programming.

I have an array of strings stored as words[10][50]. I want to extract each of the string from the array and then pass it on to another function. I tried on the following:

 #include "stdafx.h"
#include "stdio.h"
#include "conio.h"
#include "stdlib.h"

int Check_Anagram(char*,char*);

void main()
{
    char words[10][20];
    int i;
    int flag;
    for(i=0;i<3;i++)
    {
        scanf("%s\n",words[i][20]);
    }
    for(i=1;i<10;i++)
    {
        flag = Check_Anagram(words[i][20],words[i-1][20]);      
    }
    getch();
}

int Check_Anagram(char *a,char *b)
{
    printf("%s %s\n",a,b);
    return 1;
}

This creates an exception during compiling.
Now i think that when i use the “printf” statement then this nomenclature works fine i.i words[i] prints the string “i” from the double dimension words array. When i try to do the same thing with the check function then the error occurs.

Can soemone point me how to do this passing ?

P.S. Please ignore any error in efficiency of program and likewise. I need your help and this is just a test program at learning string passing to a function
Thanks

  • 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-30T03:05:18+00:00Added an answer on May 30, 2026 at 3:05 am

    You’re passing words[i][20]. You need to pass words[i] instead in both loops. Try this:

    for(i = 1; i < 3; i++) /* i < 3 */
    {
        flag = Check_Anagram(words[i], words[i-1]);
    }
    

    Another problem is that you’re reading 3 strings and trying to print 10. So when you pass words[3] it contains garbage: printf tries to print garbage which need not be 0-terminated.

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

Sidebar

Related Questions

I have a following problems with eclipse, when I installed ClearCase plugin from this
i have question from programming pearls problem is following show how to use Lomuto's
I have recently started programming in WPF and bumped into the following problem. I
I have the following problems: First: I am trying to do a 32-spaces bitwise
I have following piece of code: It compiles without problems under gcc-3.4, gcc-4.3, intel
People have been developing own solutions to the following problems: Consistent messaging frameworks for
I have problems with following code: http://lisper.ru/apps/format/96 The problem is in normalize function, which
I have the following html/css that is causing problems in Firefox 1.5 and 2,
I have problems with the following bit of javascript/jquery code: this.droppable = function(){ $('.imageWindow
I have following problem, Code: String a=Yeahh, I have no a idea what's happening

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.