linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* C99 doesn't allow local scope variables?
@ 2004-01-27  2:30 tabris
  2004-01-27  8:05 ` wwp
  2004-01-27 11:45 ` Glynn Clements
  0 siblings, 2 replies; 3+ messages in thread
From: tabris @ 2004-01-27  2:30 UTC (permalink / raw)
  To: linux-c-programming

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

simple C program

#include <stdlib.h>
#include <stdio.h>

int main(void)
{
    for (int i=0; i < 2; i++)
        printf("crap\n");
};

[tabris@tabriel tmp]$ gcc test.c -o test
test.c: In function `main':
test.c:6: error: `for' loop initial declaration used outside C99 mode

What does that mean, and why am I not allowed to make a local scope variable 
for a for{;;} loop?

works fine if i declare the variable outside the loop. But I swear I used to 
do this with gcc 2.95.
- --
tabris
- -
Body by Nautilus, Brain by Mattel.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAFc1J1U5ZaPMbKQcRAiJyAJ4namXjJa9zd6Y/VGbR+Y5pyHVjUwCcCy4s
dW251Zxh2o3I97eabiisOMg=
=21yl
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-01-27 11:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-27  2:30 C99 doesn't allow local scope variables? tabris
2004-01-27  8:05 ` wwp
2004-01-27 11:45 ` Glynn Clements

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).