"...incompatible pointer type" Can it be ended?
Its probably been asked and answered so many times now that only the last
several responsesare coming up on the search button, and those are direct answers to offshoot problems that include this warning in their compilations, I want to know, once and for all, what the compiler does this for. Can someone please post this? Right now, for the sake of simplicity ive got this example: main (int argc, char **argv[]) { char *instr; instr = argv[1]; printf("%s\n", instr); } It does its job just fine, but its got that obnoxious warning, why? |
Code:
main (int argc, char **argv[]) |
But the song remains the same, actually, it just got worse, your
suggestion compiles into a segmentation fault; i sure would like to know <b>why</b>. <code> char *foo </code> i believe this is a memory address reservation with room for one addresses as long as one byte <code> char foo[] </code> this is an illegal declaration for a good reason, finite memory, plus there are other processes in that memory that have to leave eachother alone if the system is to keep running. side note, declaring main(char foo[]) will compile where as main() { char foo[]; } will not. ive tried about 4 of the 8 possible *foo[]/*var || foo[]/var assignments, and so far i cant make any of the main (char foo[])s do anything other than cause a segmentation fault, if i find something ill ammend my post |
I'm not sure why it's not working for you:
Code:
itsme@itsme:~/C$ cat arg1.c |
All times are GMT -5. The time now is 06:45 PM. |