Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (ozgur, TipmyPip, AndrewAMD), 1,209 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 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,729
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

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