Author: Robert Hyatt
Date: 20:43:31 04/10/03
Go up one level in this thread
On April 10, 2003 at 08:00:24, Uri Blass wrote:
>On April 10, 2003 at 07:45:50, Tony Werten wrote:
>
>>On April 10, 2003 at 06:35:07, Uri Blass wrote:
>>
>>>On April 09, 2003 at 23:56:54, Russell Reagan wrote:
>>>
>>>>So...who wants to explain how this works? I don't know how it works, but it
>>>>finds all of the solutions to the 8 queens problem.
>>>>
>>>>#include <stdio.h>
>>>>int v,i,j,k,l,s,a[99];
>>>>void main(void){
>>>>for(s=8;*a-s;v=a[j*=v]-a[i],k=i<s,j+=(v=j<s&#38;&#38;(!k&#38;&#38;!!printf(2+"\n\n%c"-(!l<<!j),"
>>>>#Q"[l^v?(l^j)&1:2])&&++l||a[i]<s&#38;&#38;v&#38;&#38;v-i+j&#38;&#38;v+i-j))&#38;&#38;!(l%=s),v||(i==j?a[i+=k]=0:++a[i])>=s*k&&++a[--i]);
>>>> printf("\n\n");
>>>>}
>>>
>>>I do not understand this code because my C knowledge is not enough.
>>
>>You don't use pointers in your program ? :)
>
>I do not have * as the beginning of the line.
>
>I have only few things like
>gen_t *g;
>
>I also knew that a condition should be in the beginning of the loop so I thought
>* may mean some condition(I know that a number can be used as condition but I am
>not used to use number as condition so I did not thought about that possibility
>when I read the program).
>
>Uri
You could do this:
int *a;
int b;
a=&b;
and now
*a=0;
sets b to zero, since a is a pointer and it points to b.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.