memmem function

L

LK

I would like to know what does the following code in c-language do

int memmem(void *m1, int size1, void *m2, int size2)

??
 
M

Michael Mair

LK said:
I would like to know what does the following code in c-language do

int memmem(void *m1, int size1, void *m2, int size2)

??

Well, this code will make your compiler vomit.

In order to make it a function prototype, add a semicolon after
the closing ).
In order to make it a function definition, add { return 0; }
after the closing ).

If you want to know whether there is a memmem() function in
the C standard library, then the answer is no.

Everything else is offtopic here.

<OT>
STFW: Just look at the first result google throws
you when searching for memmem...
Basically, this function does the same as strstr but
for not nearer specified data.
</OT>

Cheers
Michael
 
F

Flash Gordon

On 6 Nov 2004 04:55:48 -0800
I would like to know what does the following code in c-language do

int memmem(void *m1, int size1, void *m2, int size2)

??

If you add a semicolon to the end of the line it provides a prototype
for a function called memmem. If you add a function definition after the
line then it defines a function. Without either of those it causes the C
compiler to produce a diagnostic.

The C standard does not provide a function called memmem, but GNU
provides it as an extension but the prototype is different. So I suggest
that you ask on a group or mailing list dedicated to whatever system you
are using.
 
D

Dan Pop

In said:
If you add a semicolon to the end of the line it provides a prototype
for a function called memmem. If you add a function definition after the
line then it defines a function.

It also invokes undefined behaviour, by defining a reserved identifier.

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top