Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (alibaba, howardR, basik85278), 756 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Passing array as argument to a function #486455
08/21/22 09:23
08/21/22 09:23
Joined: Mar 2021
Posts: 42
Casablanca, Morocco
anissyo Offline OP
Newbie
anissyo  Offline OP
Newbie

Joined: Mar 2021
Posts: 42
Casablanca, Morocco
Hello guys,

I just want to know why I can't use an array as an argument in C-lite, I think it's not possible, can someone please tell me if it's supported or not? thanks in advance =)

this code compiles normally :
Code
void delete_from_array(int index_to_del){	
}



this code does not compile and returns "syntax error" :
Code
void delete_from_array(int index_to_del, float array_to_del_from[]){	
}



Many thanks

Last edited by anissyo; 08/21/22 10:39.
Re: Passing array as argument to a function [Re: anissyo] #486458
08/22/22 16:00
08/22/22 16:00
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
In Lite-C, you use a pointer instead. So this likely does what you want:
Code
void delete_from_array(int index_to_del, float* array_to_del_from){

    //examples:
    float foo = array_to_del_from[3];
    array_to_del_from[2] = 0;
}

Re: Passing array as argument to a function [Re: AndrewAMD] #486462
08/23/22 13:42
08/23/22 13:42
Joined: Mar 2021
Posts: 42
Casablanca, Morocco
anissyo Offline OP
Newbie
anissyo  Offline OP
Newbie

Joined: Mar 2021
Posts: 42
Casablanca, Morocco
Thank you so much Andrew for your help =) =)

Last edited by anissyo; 08/23/22 13:46.

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1