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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:20:39+00:00 2026-05-16T02:20:39+00:00

Folks I think I will throw all my modest C lore away. Look at

  • 0

Folks I think I will throw all my modest C lore away. Look at this code:

int main(int argc, char** argv, char** envp)
{
  int aa;

  srand(time(NULL));

  int Num = rand()%20;

  int Vetor[Num];

  for (aa = 0; aa < Num; aa++)
  {
    Vetor[aa] = rand()%40;
    printf("Vetor [%d] = %d\n", aa, Vetor[aa]);
  }
}  

I would think that this should throw an error for two reasons – first that I am declaring both Num and Vetor after executing a command (srand), second because I am declaring Vetor based on Num, this should not be possible right? because those array sizes should not be decided at runtime but at compile time right?

I am really surprised that his works and if you guys could explain why I can actually use stuff like this would be great.

This is using GCC.

  • 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-16T02:20:40+00:00Added an answer on May 16, 2026 at 2:20 am

    These are C99 features, and it seems your compiler supports them. That’s all 😉

    From Wikipedia:

    C99 introduced several new features, many of which had already been implemented as extensions in several compilers:

    • inline functions
    • intermingled declarations and code, variable declaration no longer
      restricted to file scope or the start
      of a compound statement (block)
    • several new data types, including long long int, optional extended
      integer types, an explicit boolean
      data type, and a complex type to
      represent complex numbers
    • variable-length arrays
    • support for one-line comments beginning with //, as in BCPL or C++
    • new library functions, such as snprintf
    • etc (more)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi Folks, First of all sorry, this is going to be a moderately long
I tend to get the feeling that most folks here think SVN is gold-plated
Folks, we all know that IP blacklisting doesn't work - spammers can come in
Ok folks, I am trying to write a line of code in Classic ASP
Introduction Hello folks, I recently learned to program in C! (This was a huge
Even experienced programmers write C# code like this sometimes: double x = 2.5; double
So, folks, I have this self crafted pattern that works. After some hours (I
I am stumped on this homework problem. I think I have the right answer
I'm using IsapiRewriter on IIS6, but I think this question is more general than
I'm trying to write a Python script that will get the md5sum of all

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.