Hi,
I can assign to a struct element, but not from a procedure …
#import <flx.flxh>;
open Cstdlib;
open Carray;
open C_hack;
srand(101u);
struct heap[T] {
arr : ptr[T];
els : int;
};
fun new_heap[T] (n: int) : heap[T] =
{
return heap[T] ( (array_alloc[T](n)), 0 );
}
open C_hack;
srand(101u);
struct heap[T] {
arr : ptr[T];
els : int;
lim : int;
};
fun new_heap[T] (n: int) : heap[T] =
{
return heap[T] ( (array_alloc[T](n)), 0, n);
}
return heap[T] ( (array_alloc[T](n)), 0, n);
}
proc add_heap[T] (hp: heap[T], x : T)
{
if hp.els < hp.lim do
hp.els += 1;
hp.x
}
fun new_heap[T] (n: int) : heap[T] =
fun new_heap[T] (n: int) : heap[T] =
fun new_heap[T] (n: int) : heap[T] =
open C_hack;
srand(101u);
struct heap[T] {
arr : ptr[T];
els : int;
lim : int;
};
fun new_heap[T] (n: int) : heap[T] =
{
return heap[T] ( (array_alloc[T](n)), 0, n);
}
proc add[T] (hp: heap[T], x : T)
proc add[T] (hp: heap[T], x : T)
{
if hp.els < hp.lim do
hp.els = hp.els + 1;
//hp.els = hp.els + 1;
//hp.x.[hp.els] = x;
done;
}
#import <flx.flxh>;
open Cstdlib;
open Carray;
//open C_hack;
}
proc add[T] (hp: heap[T], x : T)
{
//hp.els = els(hp) + 1;
done;
#import <flx.flxh>;
struct heap[T] {
els : int;
lim : int;
xxx : T;
};
fun new_heap[T] (n: int, x : T) : heap[T] =
{
return heap[T] (0, n, x);
}
proc s1 (hp : heap[int], i : int)
{
hp.els = i;
}
proc p1 (hp:heap[int])
{
if hp.els == 0 do
print "heap: ";
print hp.els;
print " elements\n";
done;
}
var hp = new_heap[int](21, 101);
p1(hp);
s1(hp, 11);
p1(hp);
CAUTION: The information contained in this
e-mail is confidential and may be legally privileged. If the reader of this
message is not the intended recipient you are hereby notified that any
use, dissemination, distribution, or reproduction of this message is
prohibited. If you have received this message in error please forward this
message to [EMAIL PROTECTED] and delete all
copies of this message.
If you wish to have us block your email address from receiving any future emails from this organisation please forward this email with your request to [EMAIL PROTECTED]
You can also contact the Lion Nathan company responsible for sending this message by calling our IT helpdesk on +61 1300 300320 or you can reply directly by email to the sender above.
Thank You.------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Felix-language mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/felix-language
