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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:04:49+00:00 2026-06-13T00:04:49+00:00

Say I assigned an array like so: char* array[]={This}; And then later I wanted

  • 0

Say I assigned an array like so:

char* array[]={"This"};

And then later I wanted to assign array[ ] a new value so that it stores “This” and “That,” is there a way that I could change the size of array so that it could hold a new number of values?

  • 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-06-13T00:04:50+00:00Added an answer on June 13, 2026 at 12:04 am

    No, you can’t change the size of an array. You could use a dynamically allocated list of char* instead and realloc() as required:

    #include <stdlib.h>
    #include <string.h>
    #include <stdio.h>
    
    int main() {
        char** array = malloc(1 * sizeof(*array));
    
        if (array) {
            array[0] = "This";
    
            printf("%s\n------\n", array[0]);
    
            char** tmp = realloc(array, 2 * sizeof(*array));
            if (tmp) {
                array = tmp;
                array[1] = "That";
    
                printf("%s\n", array[0]);
                printf("%s\n", array[1]);
            }
    
            free(array);
        }
        return 0;
    }
    

    See online demo: https://ideone.com/ng00k.

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

Sidebar

Related Questions

Let's say I got this array: String[][]array = new String[5][5]; array[2][2] = desperate; Would
Let's say I have something like this: def find_the_best(array) temp = 15435435435 # sufficiently
Let's say i need to find all .bar elements inside an element that's assigned
Say I have this: private list<myClass> myCollection; Is there a programming idiom to shorten
Say i have an single dimension array (to keep it simple). Is there a
Let's say that any C function has a pointer already declared, but not assigned
There is two variable was assigned the value of 003 and 00 3. And
My setup is like this: Admin search for orders depending on say address, or
If I have a 2D array, arr[][] , and let say I do this:
Let's say I have a variable called URL and it's assigned a value of

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.