Pelles C forum

Pelles C => General discussions => Topic started by: net2011 on December 09, 2011, 05:56:03 AM

Title: error #2048: Undeclared identifier 'i'.
Post by: net2011 on December 09, 2011, 05:56:03 AM
When I try to run the following code I get "error #2048: Undeclared identifier 'i'.". Here is the code.

#include <stdio.h>

int main()
{
   i = 0;

   while (i < 10)
   {
      printf("i is now %d!\n", i);
      i++;
   }

   printf("All done!\n");
}

Thanks for the help.
Title: Re: error #2048: Undeclared identifier 'i'.
Post by: CommonTater on December 09, 2011, 06:12:49 AM
When I try to run the following code I get "error #2048: Undeclared identifier 'i'.". Here is the code.
Code: [Select]
#include <stdio.h>

int main( void )
{
      int i = 0;

      while (i < 10)
       {
          printf("i is now %d!\n", i);
          i++;
      }

      printf("All done!\n");
      return 0;
}

Simply saying i=0; does not give the variable a type.
 
Title: Re: error #2048: Undeclared identifier 'i'.
Post by: net2011 on December 09, 2011, 05:26:02 PM
Boy, I feel pretty silly now. Thanks for the help.
Title: Re: error #2048: Undeclared identifier 'i'.
Post by: CommonTater on December 09, 2011, 06:44:20 PM
Boy, I feel pretty silly now. Thanks for the help.

No worries. 

And don't feel silly.  If you aren't making mistakes you aren't learning anything new!