User Profile

Collapse

Profile Sidebar

Collapse
plasmay
plasmay
Last Activity: Jul 12 '10, 02:00 AM
Joined: Mar 24 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Thank you very much. I have found the answer right after I posted my question... Since I know a little about VB, and it will assign an default value for var when I didnt do so, so I was supposed...you know... Anyway, thanks for your reply. have a good night.
    See more | Go to post

    Leave a comment:


  • plasmay
    started a topic error of "use of unassigned local variable"

    error of "use of unassigned local variable"

    Hi, I am new in learning c#, and have recently encountered a problem:


    Code:
            static float ComputeAvg(float[] a)
            {
                float sum;
                int i;
                for (i = 0; i <= a.Length; i++)
                {
                    sum = sum + a[i];
                }
    
                float avg = sum / (i-1);
    
                return avg;
    ...
    See more | Go to post
    Last edited by tlhintoq; Mar 24 '10, 05:31 AM. Reason: [CODE] ...Your code goes between code tags [/CODE]
No activity results to display
Show More
Working...