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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:16:14+00:00 2026-05-26T17:16:14+00:00

So I ve got this: char table1[10^length][length]; char table2[10^length][length]; And compiler doesn’t let me

  • 0

So I ve got this:
char table1[10^length][length];
char table2[10^length][length];

And compiler doesn’t let me dot this:
table1=table2;

my code is supposed to take a string with wild caracters (only ?)

and give all the possible strings in the output (well it is a part of a bigger project but lets say print them in terminal – if I do this I can handle the rest)

Here is the full code:

int ** wildReplacement(char *wildAM,int length)
{
    length=7;
    char * temp;
    strcpy(wildAM,"123?23");
    //getchar();
    int i=0;
    int j=0;
    int k=0;
    int l=0;
    int limit=0;
    int wildCharsNum;
    char *nlptr= NULL;

    char table1[10^length][length];
    char table2[10^length][length];


    wildCharsNum=charOccurenciesInStr(wildAM,'?');
    strcpy(temp,wildAM);
    strcpy(table1[0],wildAM);

    printf("\n!!WildChars In wildAM:%d",wildCharsNum);


    while(k<wildCharsNum)
    {
        l=0;
        while(l<=limit)
        {
            strcpy(temp,table1[l]);
            i=0;
            nlptr = strchr(temp, '?');//ka8e fora vriskei to epomeno ?
            if (nlptr) 
            {
                for(j=1;j<10;j++)
                {
                    *nlptr = myItoc(j);//antikatastasi tou ? me digits sto temp
                    strcpy(table2[i],temp);
                    i++;
                }
            }
            l++;
        }
        table1=table2;
        limit=i;
    k++;
    }

    printf("\nWild Numbers out:");
    for(i=0;i<limit;i++)
    {
        printf("\n%s",table1[i]);
    }

}

Should I malloc like:

char ** table1
char ** table2

table1=malloc(sizeof(char)*10^length*lenght)
table2=malloc(sizeof(char)*10^length*lenght)

How would the programm know when each record ends

Then what would this mean:
table1[1] ? probably nothing…

Thanks in advance

  • 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-26T17:16:15+00:00Added an answer on May 26, 2026 at 5:16 pm

    When you malloc a two dimensional array you can’t construct something that’s identical to what the compiler would make for an array declaration. char a[100][50] is a contiguous blob of memory that’s 5000 char. When you subscript it the compiler is able to do the row/column math because it knew the size at compile time. When you malloc an equivalent two-dimensional array you have to provide a row array that indexes the rows. This is how you answer your question “how would the program know when each record ends”:

    char **b;
    int i;
    int rows = 100;
    int cols = 50;
    /* using sizeof(*b) is a good habit because there's only */
    /* one place where you have to change type information */
    b = malloc(rows * sizeof(*b));
    /* now create a bunch of rows */
    for (i = 0; i < rows; ++i) {
        b[i] = malloc(cols * sizeof(**b));
    }
    

    Notice that this takes more memory than the declared array because of the rows indexing array.

    As an optimization you can avoid the repeated malloc in the loop and parcel out memory from a single large allocation of rows * cols * sizeof(**b).

    Take care you write a matching function to free your array.

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

Sidebar

Related Questions

I've got this simple piece of code: char data[4] = { 0x13, 0x34, 0xad,
Got this line of code here but its not working. private void Button_Click(object sender,
Got this code for a viewscroller from the apple developers site. @synthesize scrollView1, scrollView2;
I got this code snippet to copy a file database to a memory database.
I got this code from Andy Tanenbaum's book. I am trying to run it.
I got this function from someone on here: create FUNCTION [dbo].[fnSplitString] (@s varchar(512),@sep char(1))
Got this site with UN/PW set via the Createuserwizard control. Client considers PW too
Got this: Table a ID RelatedBs 1 NULL 2 NULL Table b AID ID
I got this error today when trying to open a Visual Studio 2008 project
I got this output when running sudo cpan Scalar::Util::Numeric jmm@freekbox:~/bfwsandbox/sa/angel/astroportal/dtu8e/resources$ sudo cpan Scalar::Util::Numeric [sudo]

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.