Hi i get a
"subscripted value is neither array nor pointer"
when i compile my source.
the error is pointing this line
argc is the argument taken from the program parametersCode:if(strncmp(">", argc[i], 1) == 0)
Hi i get a
"subscripted value is neither array nor pointer"
when i compile my source.
the error is pointing this line
argc is the argument taken from the program parametersCode:if(strncmp(">", argc[i], 1) == 0)
Perhaps you wanted argv? You may also say:
Code:if(argv[i][0] == '>') // blah blah
It looks like the program does not pick up the > character. It will assumedly pipe it out to what ever is on the other end.
If you put it in quotes it will work. This could be awkward for your application however.
The |, < and > characters are stripped by the OS and not passed to the program. Unless you surround them with "s
Definition: Politics -- Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers
you could also lookup the ascii value for the character '>' and use that instead in the comparison
Won't work, the ">" won't get sent to the program in the first place.
Maybe you could try use a different symbol...
Code:#include <stdio.h> void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){ puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9 /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i] ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][ t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}
Are you sure you don't want this?Code:if(strncmp(">", argc[i], 1) == 0)
Code:if(strncmp(">", argv[i], 1) == 0)
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.