TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Murtaza Hasan
NA
1
22.1k
why is the error " use of unassigned local variable" ?
Feb 6 2014 10:19 AM
I m a beginner , and in this program i am trying a simple sort . I dont know why i cant print 'sw' in the FOR Loop ?
I want an output :
92
95
97
98
99
Here is my code, please help :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int[] Arr = new int[5] { 99, 98, 92, 97, 95 };
//int[] Arr = { 90, 67, 87, 2, 5 };
int a, b,i;
int kw;
for (i = 0; i < 5; i++)
{
if (Arr[i] > Arr[i + 1])
{
int sw;
sw = Arr[i + 1];
Arr[i + 1] = Arr[i];
Arr[i] = sw;
Console.WriteLine(sw);
}
Console.WriteLine(sw);
// Console.WriteLine(" Sorted Array is : ", sw);
}
Console.ReadLine();
}
}
}
Reply
Answers (
2
)
How represent CROSS JOIN load form when add combo nationali
Value embed with first field