Great programmer.

kavin

Paragon
Joined
Oct 24, 2010
Messages
2,293
Reaction score
0
FP$
256
Just got this funny mail from my sister. 😀

Try removing bug from the following program.

##########################################################
#include <stdio.h >
#define LAST 10
int main()
{
int i, sum = 0;
34y1y77.webp
for ( i = 1; i < = LAST; i++ )
{
sum += i;
}
/*-for-*/
printf("sum = %d\n", sum);
return 0;
}
##########################################################


And the developer fixes it this way.

##########################################################
#include <stdio.h>;
#define LAST 10
int main()
{
int i, sum = 0;
/*
2na4tfm.webp
*/
for ( i = 1; i < = LAST; i++ )
{
sum += i;
}
/*-for-*/
printf("sum = %d\n", sum);
return 0;
}
##########################################################
 
mikehawk said:
lol...yeah some people won't get it.

Yeah! For guys who aren't programmers, they can't understand this. 😀

I will explain this for them. An error in a program is called a bug. And obviously some kind of insects are also called bug.
The first program has a bug (The moving one).

If you noticed, we used /* and */ before and after the bug. They are comment operator, and the compiler will omit anything within comment operator. So, the bug is no more.

And yeah! If you read this explanation, there is no fun. 😛
 
Back
Top Bottom