3

I am reading Introduction to Arrays for nawk

It says:

Arrays in awk superficially resemble arrays in other programming languages; but there are fundamental differences. In awk, you don't need to specify the size of an array before you start to use it.

Then whats the limit of members I can have in that array? How do I know that? And is this error-pron? (because I know it cannot be infinite :D)

hari
  • 9,439
  • 27
  • 76
  • 110
  • 1
    Nope, probably depends on your memory space. – Rahul Aug 02 '11 at 19:47
  • @Rahul: Yes, you are right. Just wondering what would be the behavior when we cross this limit. (Other than the system crashes with a blast in fumes and you can die) – hari Aug 02 '11 at 20:08

2 Answers2

1

nawk has limits on various things from experience although I have no idea what they are and can't find a reference. gawk however doesn't so if you want security against hitting limits, try gawk. Ref here:

http://oreilly.com/catalog/unixnut3/chapter/ch11.html#ch11_09.htm

Deleted
  • 4,804
  • 1
  • 22
  • 17
  • Thanks for the reference. I believe its not defined and depends on system resources. – hari Aug 02 '11 at 20:06
1

There is no maximum size since in Awk arrays are allowed to grow and shrink as necessary. It is limited by your PC.