<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: More Pascal to C Issues in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590554#M725645</link>
    <description>Hi Pascal:&lt;BR /&gt;&lt;BR /&gt;I spent about 5 minutes putting together the 2 dimensional version. In fact, this technique can be extended to n dimensions. The problem is that this gets pretty deep pretty quickly.&lt;BR /&gt;&lt;BR /&gt;In this case I set up an array of records, arry2[50][100];&lt;BR /&gt;&lt;BR /&gt;The key is that arry2 is declared as my_rec **arry2 but USED in an array context. What you do is first allocate the rows and then allocate the columns associated with each row.&lt;BR /&gt;&lt;BR /&gt;We still haven't covered the case of truly dynamic arrays. In this case, the arrays are set up but do not change beyond that. It allows you to size arrays from the command line or from a configuration file but does not allow you to expand them as needed. That too is possible but I'm already beginning to feel that I am teaching C again.&lt;BR /&gt;&lt;BR /&gt;Anyway, here's the attached code.&lt;BR /&gt;&lt;BR /&gt;Clay</description>
    <pubDate>Fri, 05 Oct 2001 20:06:31 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2001-10-05T20:06:31Z</dc:date>
    <item>
      <title>More Pascal to C Issues</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590553#M725644</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;A. Clay Stephenson gave me an example of how to allocate a variable sized array in C but his example was for a one-dimensional array. Is this also possible with two-dimensional arrays? &lt;BR /&gt;&lt;BR /&gt;I like to understand the big picture before I start on a project this big.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;</description>
      <pubDate>Fri, 05 Oct 2001 18:57:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590553#M725644</guid>
      <dc:creator>Greg White</dc:creator>
      <dc:date>2001-10-05T18:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: More Pascal to C Issues</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590554#M725645</link>
      <description>Hi Pascal:&lt;BR /&gt;&lt;BR /&gt;I spent about 5 minutes putting together the 2 dimensional version. In fact, this technique can be extended to n dimensions. The problem is that this gets pretty deep pretty quickly.&lt;BR /&gt;&lt;BR /&gt;In this case I set up an array of records, arry2[50][100];&lt;BR /&gt;&lt;BR /&gt;The key is that arry2 is declared as my_rec **arry2 but USED in an array context. What you do is first allocate the rows and then allocate the columns associated with each row.&lt;BR /&gt;&lt;BR /&gt;We still haven't covered the case of truly dynamic arrays. In this case, the arrays are set up but do not change beyond that. It allows you to size arrays from the command line or from a configuration file but does not allow you to expand them as needed. That too is possible but I'm already beginning to feel that I am teaching C again.&lt;BR /&gt;&lt;BR /&gt;Anyway, here's the attached code.&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Fri, 05 Oct 2001 20:06:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590554#M725645</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-10-05T20:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: More Pascal to C Issues</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590555#M725646</link>
      <description>Thank you! I can't believe you did that in 5 minutes. I would have spent hours doing that.</description>
      <pubDate>Fri, 05 Oct 2001 20:20:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590555#M725646</guid>
      <dc:creator>Greg White</dc:creator>
      <dc:date>2001-10-05T20:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: More Pascal to C Issues</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590556#M725647</link>
      <description>Hi Pascal:&lt;BR /&gt;&lt;BR /&gt;I confess I did cheat a little bit. I basically yanked that out of some existing code and added the part dealing with looping through the array. Since you mentioned dynamic arrays, I've been racking my brain trying to remember how I used to do that in Pascal. I remember something about using a free union and turning range checking off around any code that accessed the array by I can't remember much beyond that.&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Fri, 05 Oct 2001 22:58:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590556#M725647</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-10-05T22:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: More Pascal to C Issues</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590557#M725648</link>
      <description>Hello Clay,&lt;BR /&gt;&lt;BR /&gt;Thank you for your two-dimensional array example. I can't seem to do the allocation in a function. I have about ten arrays of the same record type but withing different size. I know this is something simple but these ******** C pointers are insane.  Can you show me how to do this?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Oct 2001 14:08:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590557#M725648</guid>
      <dc:creator>Greg White</dc:creator>
      <dc:date>2001-10-08T14:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: More Pascal to C Issues</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590558#M725649</link>
      <description>Hi Pascal:&lt;BR /&gt;&lt;BR /&gt;Can I show you how to do this? Does a hog like slop?&lt;BR /&gt;&lt;BR /&gt;Actually C pointers are not insane, it's just that in Pascal you have pass by value and pass by reference (VAR) so that the underlying details were hidden. In Pascal, you could go all the way through a first semester course and never see a pointer; in C you might go to or two days.&lt;BR /&gt;&lt;BR /&gt;The key here is *** my_rec - a pointer to a pointer to a pointer. I've modified the earlier code to include a integer function allocate_array. 0 means all went well. You specify the number of rows and columns and the *** my_rec. I've commented the call so you see to use the &amp;amp; operator in the function call. This is similar to a boolean function in Pascal with one of the VAR params being set as a side effect. The other method is to let the function return the array itself or NULL on failure. I'll do that variant if I have time.&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Mon, 08 Oct 2001 14:37:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590558#M725649</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-10-08T14:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: More Pascal to C Issues</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590559#M725650</link>
      <description>Hi again:&lt;BR /&gt;&lt;BR /&gt;Here is the other method that returns a pointer to the array. I really prefer the previous method since the status is returned as well as a pointer. The code is a bit clearer in this example.&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Mon, 08 Oct 2001 15:24:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-pascal-to-c-issues/m-p/2590559#M725650</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-10-08T15:24:44Z</dc:date>
    </item>
  </channel>
</rss>

