To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 3743
3742  |  3744
Subject: 
Re: problems with creating arrays of larger sizes
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Mon, 17 May 2004 07:24:57 GMT
Viewed: 
5235 times
  
In lugnet.robotics.rcx.legos, Andreas Jurk wrote:
OK, here is my code.

#include <dmotor.h>
#include <dsensor.h>
#include <unistd.h>
#include <dbutton.h>
#include <conio.h>
#include <stdio.h>


#define n 1000

void verzoegerung(unsigned long zeit)
{
  while(zeit--);
}

int main()
{
int i;
char c[n];

cputs("Anfang");

verzoegerung(20000);

for(i=0;i<n;i++)
{
*(c+i)=0;
}

cputs("ENDE");

return 0;
}


I also found out that after changing the array type e.g. in long or integer and
changing the large so that the array reserves space over 0.97 kB will crash the
RCX.



Hi Andreas

I would suggest, that you instanciate your variable as global, and not within
the main() function. Or declare it as static so that the compiler does not try
to instanciate it on the stack. The problem could be due to a stack overflow.



Message is in Reply To:
  Re: problems with creating arrays of larger sizes
 
OK, here is my code. #include <dmotor.h> #include <dsensor.h> #include <unistd.h> #include <dbutton.h> #include <conio.h> #include <stdio.h> #define n 1000 void verzoegerung(unsigned long zeit) { while(zeit--); } int main() { int i; char c[n]; (...) (21 years ago, 17-May-04, to lugnet.robotics.rcx.legos)

6 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR