How to check if something exists in linked list in C?
i have a linked list set up like
before adding to the list i check if it already exists, only if it does not then i add
it adds the client the first time, but then the next time, always detects that the new client is already there...
somehow strcmp is always resulting true after the first time...
What's the original source of the client name you're passing in? Are you reusing that buffer?
Because your "add_client()" code never makes a copy of that string, it just uses the address of the string that gets passed in. If you reuse the original string, you'll change the data in the node on the linked list.
Hi, I am programming in kernel, and I want to use a double linked list that holds infos that every process could access and modify THIS list. So, I suppose it is a 'global' variable since every process(thread) can reach it, I am wondering where to put it? by changing some of the kernel files? (1 Reply)
Hi
#Testing for file existence
if ; then
echo 'SCHOOL data is available for processing'
else
echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING'
:
i wrote a script, where it begins by checking if file exists or not.
If it exists, it truncates the database... (2 Replies)
can someone provide an example of a struct linked list, where it has strings as its values, and then how do I check if a specific string (say called buffer) exists in the list of structs?
i dont understand how to make a copy of it to check with
this is what i have
... (0 Replies)