On Tue, 21 Jul 2009 09:56:26 -0400,
<> wrote:
> #include <conio.h> /* getche */
I hope you realize that this is a non-standard header, which makes the
code totally non-portable.
Quoting Wikipedia: "conio.h is a header file used in old MS-DOS compilers
to create text user interfaces. It is not part of the C programming
language, the C standard library, ISO C nor is it required by POSIX."
> int main(void)
> {
> char *list[10] ; /* 10 pointers array */
> char *temp ; /* for sorting */
> if (strcmp(buffer, '0') ) /* same as above 1° */
....
> } while ( i < 10 && strcmp(buffer, '0') ) ; /* same as 1° */
....
> I get in function main : line 25and 45 parsing argument 2 of strcmp
> makes integer without a cast
Your code is poorly formatted, and without line numbers, but I'm guessing
that
the lines I've quoted are lines 25 and 45, and that you've typed in what
you
remember of the error message, instead of copying and pasting it, and that
the
error message really says "makes pointer from integer without a cast".
The second argument to strcmp should be a pointer. '0' is not a pointer;
it's
a character constant, which is a kind of integer. (Probably the number
48, which is
the ASCII value of the character '0'). If you're trying to test whether
buffer
contains a string consisting only of the character 0, then argument 2 to
strcmp
should be "0", not '0'.
>
> line 55 assignement type from incompatible pointer type
> line 56 error : incompatible type in assignement
Again, it would be good manners for you to identify the specific lines
involved,
rather than expecting people to count lines in an oddly-formatted (by the
time it
gets to Usenet) posting. But it looks like these are lines 55 and 56:
> temp = list ;
> list = list[n+1] ;
temp is a (char *).
list[n+1] is a (char *).
list is an array.
Neither of these two lines of code makes any sense.
In the first statement, on the right-hand side of the = operator,
the expression "list" is equivalent to "&list[0]",
i.e. the address of the first item in the array, i.e.
a pointer to a (char *), or a (char *).
You can't assign a (char **) to a (char **).
This is the "incompatible pointer type".
In the second statement, on the left-hand side of the assignment
operator, "list" does NOT get converted into the address of its
first element. "list", being an array, is not a variable which
can be assigned to.
I can't tell what you're actually trying to do here, but I'm not
trying very hard. What you need to do is go study some more
about pointers and arrays, and examine your code very carefully
and figure out what it is that you're trying to do with this
code. More comments would help, for a start.