Raised This Month: $ Target: $400
 0% 

Solved How to set dynamic array size


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 02-11-2023 , 20:13   How to set dynamic array size
Reply With Quote #1

Hello guys, I recently started reading about arrays and how to sort integers etc.

Anyway, I have a stored data file with a list of clients, and I'm trying to set the array count to the numbers in the list. Then I will sort these clients in a Descending way with certain value.

PHP Code:
void SortDescending()
{
    
int iCount GetTotalPlayersInTheList();
    
int iArray[iCount]; //Error Here
    
    //Then I will do something with it

But it always gives me error
Quote:
brackets after variable name indicate a fixed-size array, but a dynamic size was given - did you mean to use 'new int[size]' syntax?
I would like only to know how to set "iArray" count to be equal to "iCount".
__________________

Last edited by alasfourom; 02-12-2023 at 13:02.
alasfourom is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:58.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode