S
Sandeep
http://www.faqs.org/faqs/C-faq/abridged/
3.1: Why doesn't the code "a = i++;" work?
A: The variable i is both referenced and modified in the same
expression.
Here is the code that I have written:
#include <stdio.h>
int main ()
{
int a[] = {1,2,3,4,5,6};
int i=1;
int j;
a = i++;
for(j=0;j<6;j++)
printf("%d\n",a[j]);
}
Outout (using gcc (GCC) 3.4.2 (mingw-special))
1
1
3
4
5
6
It works fine for me ! Maybe I have not understood the question "Why
doesn't the code "a = i++;" work?" . Any ideas ?
3.1: Why doesn't the code "a = i++;" work?
A: The variable i is both referenced and modified in the same
expression.
Here is the code that I have written:
#include <stdio.h>
int main ()
{
int a[] = {1,2,3,4,5,6};
int i=1;
int j;
a = i++;
for(j=0;j<6;j++)
printf("%d\n",a[j]);
}
Outout (using gcc (GCC) 3.4.2 (mingw-special))
1
1
3
4
5
6
It works fine for me ! Maybe I have not understood the question "Why
doesn't the code "a = i++;" work?" . Any ideas ?