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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:47:32+00:00 2026-06-10T19:47:32+00:00

int num = atoi(argv[1]); unsigned long times[num]; I have this code and I assumed

  • 0
int num = atoi(argv[1]);
unsigned long times[num];  

I have this code and I assumed it won’t compile because I am trying to allocate the array using a value from a command line argument, which compiler doesn’t know at the compile time.
But I compiled this code and it worked.
Can someone explain what is going on here??
Am I misunderstanding the basic concept of static allocation??

  • 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-10T19:47:34+00:00Added an answer on June 10, 2026 at 7:47 pm

    C99 allows to allocate an array with a var. This is called variable length arrays aka VLA

    I don’t have the C99 in my hand, the section is 6.7.5.2 in C99, and the following links are from the internet.

    vla – wikipedia

    c99 – wikipedia

    be aware that vla is not supported in c++, more information here

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

Sidebar

Related Questions

How would I convert this code to have n nested for loops: int num
Lets assume we have the following code: abstract class Base1 { protected int num;
For this code block: int num = 5; int denom = 7; double d
If I have these code: unsigned char **keys; int *num_keys; int num_images = (int)
I have the following function: + (int)isCorrectOnServer:(int)num { // some code performs here... if
This code: print( - Start); int[] num = new int[] {1,2,3,4,5,6,7,8,9,10}; for(int i :
Java code... If I have int num = 10 + 5; System.out.println(num); The result
Suppose I have template< unsigned int num > class SomeFunctionality { static unsigned int
I have the following function in my code: int numberOverflow(int bit_count, int num, int
I have a number like this: int num = 36729; and I want to

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.