Don't know if it's a really dumb thing to ask as I feel it goes against C syntax.But I am not sure.I stumbled across that in a question posted few minutes back.The OP uses something like (int i = 0; i < n; i++)
, ie without even a ;
after i++
.
Fibonacci Series in C - The series of numbers up to a given number
But though the OP's line is obviously wrong, I am tempted to ask something I just don't know- What does the following mean in C :
(int i = 0; i < n; i++;) // Three `;` terminated statements enclosed in ()
as the following simply means a block of statements in C:
{int i = 0; i < n; i++;}
I mean, what does (int i = 0,n=3; i = n; i++;)
mean in the following dummy program:
#include<stdio.h>
int main(void)
{
(int i = 0,n=3; i = n; i++;)
}
Edit Even that single line sourced from that original question is ridden with errors.So let me ask this independently : What does it do if we enclose multiple ;
terminated statements within a pair of ()
? If we enclose within {}
it becomes a block,but what about ()
?
Nothing. The parentheses are used in certain situations such as boolean expressions and for loop comprehensions. You'll get a bunch of syntax errors.