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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:44:00+00:00 2026-05-27T14:44:00+00:00

The code: int main(int argc, char *argv[]) { typedef struct lb_data_US { char uname[255];

  • 0

The code:

int main(int argc, char *argv[])
{
    typedef struct lb_data_US
    {
        char uname[255];
        char Eid[4];
        char myrole[4];
        char Login_t[30];
        char Logout_t[30];
        char ClientIP[20];
        char ZoneName[256];
    };

    int x = atoi(argv[1]);
    lb_data_US  lb_local[x];
    printf("stands for %d value\n", x);
    exit(0);
}

When I run this code using ./structure_testop 20995, it runs completely but when i run this code with a larger argument (like 20996 or more), it fails occasionally…
When i tried to debug it by gdb it says

Program received signal SIGSEGV, Segmentation fault.
0x003d6773 in _IO_vfprintf_internal (s=<value optimized out>, format=<value optimized out>, ap=<value optimized out>)
at vfprintf.c:233
233       int save_errno = errno;
Current language:  auto; currently c"

Can anyone explain 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-27T14:44:00+00:00Added an answer on May 27, 2026 at 2:44 pm

    Assuming you are actually using C++ which supports dynamic array sizing like that, consider what an argument of 20995 does: it dynamically allocates 20995 times sizeof lb_data_US (which is about 600) for a total allocation of 12.5+ megabytes. Few environments support such a large stack size. Instead, use the heap via malloc() supported in many environments for process limit sorts of sizes.

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

Sidebar

Related Questions

I have this code #include <iostream> using namespace std; int main(int argc,char **argv) {
The code #include <QtCore> #include <QtXml/QDomElement> int main(int argc, char *argv[]) { QCoreApplication app(argc,
Here's my code. #include<stdio.h> struct element { int value; char activity; }; typedef struct
When I run this code: #include <stdio.h> typedef struct _Food { char name [128];
typedef struct Model { int recordId; char *name; }Model; typedef struct ModelArray { //keeps
Code: #include <unistd.h> #include <stdio.h> typedef struct hddinfo { char szDevice[4]; char szMfg[64]; char
Consider the following code: int main() { int *p; ++((int){5}); //compile without err/warning &((int){5});
Consider this code: int main() { int e; prn(e); return 0; } void prn(double
I have the following code int main() { int a=6; void *p; p=&a; p++;
Consider the following code: int main() { int i; volatile int* p = &i;

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.