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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:24:05+00:00 2026-06-02T12:24:05+00:00

A long time ago a got stuck with a problem: if I need to

  • 0

A long time ago a got stuck with a problem: if I need to make a small program that use variables, how do you define and unknown amout of variables?.

I.E, if you have a program that ask user to input a number, then the number user input is the numer of variables needed in program. In Java or VB is easy solve this because you can define variables as you need them (on the go), but pascal makes you declare them BEFORE main program code start, so you can’t use this trick.

I was thinking on a multi dimensional array, but I think that is a poor way to fix this, because if you define less “squares” than you need you get short and if you define more than you actually are gonna use then you are gonna waste memory…

So, how do you define an unknown amount of variables?

  • 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-02T12:24:12+00:00Added an answer on June 2, 2026 at 12:24 pm

    You can dynamically resize the array using SetLength

    Type 
      TByteArray = Array of Byte;
    
    Var
      Data : TByteArray
      NewSize : Integer;
    Begin
      Write('Enter the number of bytes you require: ');
      ReadLn(NewSize)
      SetLength(Data, NewSize);
      ...
    End;
    

    Excuse any syntax errors, I have not used Pascal in more that 20 years. What a great language!

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

Sidebar

Related Questions

I had this problem a long time ago and recently I got some clues
A long time ago I remember reading that you should always use the smallest
long time ago I wrote webservice that is still in use. Now I plan
I remember that I've seen this effect long time ago on a website. It
A long time ago I used to program in C for school. I remember
I read a long time ago about a rule that using an object we
I've learnt from somewhere a long time ago that specifying width and height for
So we already have a web service that was develop a long time ago.
I've got a relatively long function that's dominant in the Instruments Time Profiler. Is
I rewriting some code that i written a long time ago. The code is

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.