Jump to content

This Will Seem Very Strange But I Trust You!!


gaza165

Recommended Posts

Hi Guys,

 

I know this is a forum for PHP and I know this might not be replied to but i am having a problem with another language and i have been gaining knowledge from you guys for ages and i know how quickly everyone responds.

 

I am programming in Processing 1.0 Beta for my Uni and they have asked me to do a simple problem.

 

Its a simple method that outputs numberts from an array...

 

The error i am getting is "This method must return a result of type int".... where am i going wrong??

 

 

  
// Declare my Global Variables  
  int i;
  String OutPutLine = "";
  PFont font;
  String[] Strs;
  int Size;
  int[] Nums;
  int Sum;


//run the first method
void setup() {

  
  font = loadFont("CourierNewPS-BoldMT-24.vlw"); 
  textFont(font);
  background(255, 255, 0);
  fill(0, 0, 0); 
  int[] Nums = { 90, 150, 30 };

}

//run my created method
int Sort(int[] Nums) {
        
    for (i = 0; i < 3; i++) {
     
    return Nums[i];    

    } 
    
}

 

 

What language is this?  Looks like C/C++ but could easily be something else.

 

 

Why not just pass by reference and not have to worry about a return?

 

IE:

 

void someFunction(int[] &var) {
    for(int i = 0; i < 3; ++i) {
        var[i] = i;
    }
}

 

 

That is probably the most pointless method I've ever seen in my life though x.x.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.