There is partial code in C - typedef struct message {
-
int messageId;
-
char *messageText;
-
struct message *next;
-
}message;
-
.....
-
.....
-
.....
-
/* Get a node before a node */
-
message *nodeBefore ( message *text ) {
-
message *tem;
-
tem = head;
-
/* If there are only 2 nodes ( a and b ),then nodeBeforeByText of a is returning to a */
- 184:if ( strcmp(tem->messageText,text) == 0)
-
return tem;
-
else {
-
while ( tem != NULL ) {
- 188: if ( strcmp(tem->next->messageText,text) == 0 )
-
break;
-
else
-
tem = tem->next;
-
}
-
}
-
return tem;
-
}
-
When I compiled there were messages : -
q2.c:184: warning: passing arg 2 of `strcmp' from incompatible pointer type
-
q2.c:188: warning: passing arg 2 of `strcmp' from incompatible pointer type
-
After looking up the reference for strcmp() in library, I still dont understand why there are messages here.Can some body explain to me.
2 2078 Laharl 849
Recognized Expert Contributor
text is a message*, a pointer to a message (the struct type), not a string, a char*, which is what strcmp expects.
text is a message*, a pointer to a message (the struct type), not a string, a char*, which is what strcmp expects.
Yeah Thanks. I got it now
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Lian |
last post by:
Hi all,
I am confused by the rule of comparing two unicode string using
function "strcmp".
For exmaple, using "strcmp" to compare two Chinese uincode string,
depending on what rule can "PHP" decide one string is greater or less
than the other string?
Thank you for suggestions!
|
by: CoolPint |
last post by:
While I was testing my understanding of Functioin Template features by
playing with simple function templates, I got into a problem which I
cannot understand. I would be very grateful if someone offered me a
kind explanation. TIA
Function template and specialization below works fine:
template <typename T>
T maximum (T a, T b)
{
|
by: Andrew |
last post by:
Is it possible a constructor of a class to use a funtion defined in
the same class ????
|
by: Francis Bell |
last post by:
Hello,
I've got a program that is reading in a data file of 25 lines. Here is
an example of the first two lines:
sp/spinnerbait/AAA Lures/Mad Phil/silver/bass/1/1
f/floating minnow/AAA Lures/Skinny Minney/green/bass/0/0/0
In my program, I need to read in each line, BUT, I need to build a
different object based upon the characters in...
|
by: xuatla |
last post by:
Hi,
I want to compare two strings regardless of the lowercase or uppercase.
For example, "txt" same as "TXT", "Txt", ...
I know that there's stricmp in some c++ that can perform a lowercase
comparison. But when I use <cstring>, I can't find such function. Do you
know any other standard c++ function(s) can do this task?
Thanks,
| |
by: Steven |
last post by:
Hello,
I have a question about strcmp(). I have four words, who need to be
compared if it were two strings. I tried adding the comparison values
like '(strcmp(w1, w2) + strcmp(w3, w4))', where w1 and w2 make up the
first string and, w3 and w4 make up the second string. I do not want
to allocate memory, then put the words together to create...
|
by: CodeBlaster |
last post by:
Hi to all of you, I m new to C programming & i have a question
*Generate a series such that after taking a number (e.g.99),when we
press enter, the program should give an output which has no repeated
digits & should contain no zeros (i.e after 99 123 is such a number).
|
by: Bill Cunningham |
last post by:
As I have been studing my tutorial I came up with this question. I took
char passw(char name);
and initialied this function in a header with other includes for standard
library headers. This doesn't seem to work so is what I want this?
char passw(char *name);
I haven't got to pointers in the tutorial and I'm taking my time. But in
this...
|
by: mdh |
last post by:
May I ask the following.
By K&R's own admission, the example used to describe function pointers
is complex ( on P119). In addition, the use of casts has been stated
by some on this group as being, again, a poor/bad example of it's use.
For the moment, accepting these criticisms, I would still like to get
some insight into why/how some...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |