How to fix the bugs in source code?

The advantage of open source software is that we can fix the bugs if we find any.

When I was checking a piece of code from a open source software, I found a bug and fixed it myself too.

Here is the code with the bug.

############ ######### #########
#include
#define LAST 10

int main()
{
int i, sum = 0;


for ( i = 1; i < = LAST; i++ )
{
sum += i;
}

/*-for-*/
printf(“sum = %d\n”, sum);
return 0;
}
############ ######### #########

Here is How I fixed the source code


############ ######### #########

#include stdio.h;
#define LAST 10

int main()
{
int i, sum = 0;

/*

             */

for ( i = 1; i < = LAST; i++ )
{
sum += i;
}

/*-for-*/
printf(“sum = %d\n”, sum);
return 0;
}
############ ######### #########

All there are possible when the code is shared with others.
As he shared the code, I can able to find the bug and fix it.
Share your code and let the community fix the bugs and improve it.

3 thoughts on “How to fix the bugs in source code?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s