Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
4 registered members (NewbieZorro, Grant, TipmyPip, AndrewAMD), 13,346 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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,806
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,806
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