![]() |
|
#1
|
|||
|
|||
Mrscan someone help me fix this this program:
everytime i am running the program is giving me this error message: two or more data types in declaration of `printArray' here the program code CPP / C++ / C Code:
Last edited by LuciWiz : 31-Jan-2005 at 14:28.
Reason: Please insert your C code between [c] & [/c] tags
|
|
#2
|
||||
|
||||
|
CPP / C++ / C Code:
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds |
|
#3
|
|||
|
|||
Can some on correct my codei am using data structure in C. i have to use the struct data *headptr. the one u sent me doesn't work either
|
|
#4
|
|||
|
|||
|
Quote:
Here's a hint: If you want someone to help you understand the errors, you should list the exact error (paste from your compiler message window to the post). That lets us see what you are seeing. Different compilers have different ways of reporting errors. You could also tell us what compiler and what operating system you are using (sometimes it makes a difference). Now, that being said, if you got a message like this, for example Quote:
That tells us (and you) that the compiler is having problems when it gets to line number 14 of your source file (in my case, the file is named z.c). Now line 14 of my file is: CPP / C++ / C Code:
And there is nothing wrong with line 14(!) So what now? Well, look at stuff in the line(s) just before line 14. Here is some context (from your posted code): CPP / C++ / C Code:
So what could be happening? OH! Look! no semi-colon after the closing bracket for the struct declaration (actually line 10 in my file). Man, if I had a nickel for every time I have done that, I would have ... well, more than a nickel. Put the semi-colon there, try another compilation and that particular error goes away. Now, as you compile the program (and it compiles now), look for any other compiler messages. In particular, I get: Quote:
Now here's line 182 in my file: CPP / C++ / C Code:
The line by itself looks OK, but what does it mean "Suspicious pointer conversion"? There aren't any pointers in this expression. OH! Look ... Regards, Dave |
|
#5
|
|||
|
|||
|
i am using the dev-C++ compiler in the main function
printArray(iarray) is giving me this error. i put comma in line 10 but still having this error: warning: passing arg 1 of `printArray' from incompatible pointer type this function (printArray) print the contents of the array as initialized in the main . it recieves a pointer to the array and returns nothing. i am also trying to create a function called make list. it's called by the mainand recieved the address of the heaptr,tailptr,and iarray and returns nothing. as follow: read 1st value in the array call makenode set head and tail to the address from makenode add new allocated node to the list if newnode less than value contained in the first node add to the head Quote:
|
|
#6
|
|||
|
|||
|
Quote:
CPP / C++ / C Code:
printArray is defined to take an argument of "pointer to struct data" You call it with an argument that is "struct data". The error message says: Argument 1 is incompatible pointer type. What else do you need to know? Regards, Dave |
|
#7
|
|||
|
|||
|
i got it
can someone helpme with the function void makelist(); Quote:
|
|
#8
|
|||
|
|||
can someone help mei am using the dev c++ compiler
the program running fine but there is a lot of warnings which are : 65:`addtofront' was previously implicitly declared to return `int' 88 c:\ warning: type mismatch with previous implicit declaration 43 c:\ warning: previous implicit declaration of `addtoEnd' 88 c:\ warning: `addtoEnd' was previously implicitly declared to return `int' 40 c:\ warning: previous implicit declaration of `addtofront' 64 c:\ warning: type mismatch with previous implicit declaration CPP / C++ / C Code:
Can some one tell me what wrong Last edited by LuciWiz : 26-Mar-2006 at 09:01.
Reason: Please insert your C code between [c] & [/c] tags
|
|
#9
|
|||
|
|||
|
Quote:
In C, it is technically legal (but definitely not recommended) to use a function before its exact nature is known by the compiler. When the compiler sees a function being used and it doesn't know what kind of function it is and what its arguments are: It assumes the function must return an int, and all of its arguments are int. Then later, when you actually define the function and the return type or some of the arguments are not ints, the compiler complains. The way you tell the compiler the nature of the function is to declare it with a prototype before it is actually used anywhere in your program file. People typically put function prototypes in header files that are #included in the program, or put protototype declarations somewhere in the scope of their usage before they are actually called. You can get past this point simply by putting prototype declarations near the top of your file, say just after your #include statements. Code for the functions themselves can stay where it is in your file; just put in the following: CPP / C++ / C Code:
(You have other problems, but at least you get rid of these "implicit declaration" messages, and now you know what they mean if you ever see them again --- I see them lots of times and the fix is quick.) Regards, Dave |
|
#10
|
|||
|
|||
|
i am getting this error : two few arguments to function 'addtofront'
line 52: if(newnodeptr<=*headptr) { addtofront(newnodeptr); what that means Quote:
|
Recent GIDBlog
A Week in Kuwait by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The