Noeud:Success! ...or is it?, Noeud « Next »:, Noeud « Previous »:Try Again - Again..., Noeud « Up »:An example debugging session using gdb



Success! ...or is it?

So we can be proud of ourselves now - we have a working program at last!

Hold on a moment, though - let's look back through the code.

     24	  /* Make our own local copy of argv[1] */
     25
     26	  strcpy( buf, argv[1] );
     27
     28	  /* print it out to show we received it correctly
     29
     30	  printf( "The word is '%s'\n", buf );
     31
     32	  /* Now step through counting letter 'e's */
     33
     34	  for( i=0; i<strlen(buf); ++i )
     

What happened to line 30? We should have seen the word printed out, but there was no sign of it.

Looks like we have yet another bug to find. (I'm glad I made this program up to demonstrate bug finding - I'd hate to make this many errors in a real program. Although I have had days like that...)