Hi, no, she doesnt want a date! She is learning C, ( I do C++ )
anyway, the question she asks comes from a text book. The sample code it has I have placed below with the comment from the book included. She wants to know why in C++ you can have the control variable inside a for loop and in C it must be declared outside. i personally think it has somthing to do when they changed the standard in C++, but I could be wrong..
Here is the code, what is the reason? read the comment in the code for a better understanding!
Code:
#include <stdio.h>
int main()
{
int i; /* in C, you MUST declare the control variable outside the
loop. This is not the case in C++, where control variables
can be initalized inside the loop */
for ( i = 0; i <= 10; i++ )
{
printf("%d", i);
}
getchar();
return 0;
}