New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Size of Arrays


Post Reply New Thread Subscribe

 
Thread Tools
wvtrammell

 
Member Since: Jan 28, 2012
Posts: 24
wvtrammell is on a distinguished road

wvtrammell is offline
I have 4 gigabits of memory but in Xcode the largest array I have been able to assign is [25000][81]. I am working with Sudoku puzzles. That does not fill my memory how do I set larger arrays? Help please.
Warren Trammell
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,665
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
Moved thread to more appropriate forum.

I'm not a professional programmer (nor do I even like ObjC) but what kind of array are you trying to create? Some sample code would also help.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Personal Twitter
QUOTE Thanks
wvtrammell

 
Member Since: Jan 28, 2012
Posts: 24
wvtrammell is on a distinguished road

wvtrammell is offline
I am trying to read into memory a large group of Sudoku puzzles by declaring an int array[x][81] where x is 49151 but the largest Xcode will allow is something under 25000.
Warren
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,665
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
Have you tried using NSArray instead?

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Personal Twitter
QUOTE Thanks
wvtrammell

 
Member Since: Jan 28, 2012
Posts: 24
wvtrammell is on a distinguished road

wvtrammell is offline
#include <iostream>

FILE *reed;

int main(int argc, const char * argv[])
{
int a, b, array[25879][81];

if((reed = fopen("//Users//warren//documents//misc//sudoku17","r")) == NULL)
{
printf("\n Can't open input file for reading:");
exit(1);
} // insert code here...
for(a = 0; a < 25000; a++)
{
for(b = 0; b < 81; b++)
{
fscanf(reed,"%i",&array[a][b]);
}
}
return 0;
}
That is the largest array Xcode will accept.It balks at 25880.
Changing the name of the variable probably will not help.
Warren
QUOTE Thanks
cptkrf

 
Member Since: Dec 08, 2009
Location: The same as Sheldon Cooper - East Texas
Posts: 364
cptkrf is a jewel in the roughcptkrf is a jewel in the rough
Mac Specs: MacMini,2013, Intel Core i7, 16gb, 27" Thunderbolt display (Highly recommended!)

cptkrf is offline
IMO you are taking the long way around. Instead of trying to use an array with humongous indexes, why not just use a lightweight database like SQLITE and dump your puzzles into that? It looks like you are trying to do exactly one of the things that a DB is good for. For one thing, you wouldn't have to load that huge array every time you ran the program - it would just be setting there on disk waiting to be used.

If you've mastered Xcode, sqlite3 would be nothing to learn. Or even the open source version of MySql.

Just an idea.
QUOTE Thanks

Post Reply New Thread Subscribe


« Problem including X11 in XCode. | java »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Resize windows to specific size using Automator or Applescript? DaGrandMastah OS X - Apps and Games 3 02-13-2012 11:51 AM
Printing Issue on Custom Size Cards despard5 OS X - Operating System 6 11-27-2011 01:36 AM
File size Doubling when "duplicating" or "exporting" in Lions Preview app. WHY? codyppc OS X - Operating System 4 07-28-2011 12:04 AM
About changing the folder size of Mac Os X... Sleepless87 OS X - Operating System 3 01-15-2011 11:00 AM
how to make size adjustment permanent with safari? twitch77 OS X - Apps and Games 1 09-12-2008 11:28 PM

All times are GMT -4. The time now is 11:28 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?