Linking at the beginning is easier.
Linking at the end either requires traversing to the end of the list, then linking to it.
Or, more efficient, have an external end pointer in addition to the start pointer:
This time we need an if clause, because the first element needs to be treated differently.
Last edited by MadeInGermany; 02-27-2013 at 02:02 PM..
Reason: Forgot to update the end pointer
i have a linked list set up like
typedef struct client_list {
char *client_name;
int client_socket_fd;
struct client_list *next;
} client;
client *client_list=NULL;
before adding to the list i check if it already exists, only if it does not then i add
if (client_list==NULL... (1 Reply)
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)
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)
Program to reverse a linked list by traversing only once. (1 Reply)
Discussion started by: VSSajjan
1 Replies
LEARN ABOUT DEBIAN
blt_treecreatenode
Blt_TreeCreateNode(3) BLT Library Procedures Blt_TreeCreateNode(3)__________________________________________________________________________________________________________________________________________________NAME
Blt_TreeCreateNode - Creates a node in a tree data object.
SYNOPSIS
#include <bltTree.h>
Blt_TreeNode
Blt_TreeCreateNode(tree, parent, name, position)
ARGUMENTS
Blt_Tree tree (in) Tree containing the parent node.
Blt_TreeNode parent (in) Node in which to insert the new child.
const char *name (in) Node label. If NULL, a label will automatically be generated.
int position (in) Position in the parent's list of children to insert the new node.
_________________________________________________________________DESCRIPTION
This procedure creates a new node is a tree data object. The node is initially empty, but data values can be added with Blt_TreeSetValue.
Each node has a serial number that identifies it within the tree. No two nodes in the same tree will ever have the same ID. You can find
a node's ID with Blt_TreeNodeId.
The arguments are as follows:
tree The tree containing the parent node.
parent Node in which the new child will be inserted.
name Label of the new node. If name is NULL, a label in the form "node0", "node1", etc. will automatically be generated. Name can be
any string. Labels are non-unique. A parent can contain two nodes with the same label. Nodes can be relabeled using Blt_TreeRe-
labelNode.
position Position the parent's list of children to insert the new node. For example, if position is 0, then the new node is prepended to
the beginning of the list. If position is -1, then the node is appended onto the end of the parent's list.
RETURNS
The new node returned is of type Blt_TreeNode. It's a token that can be used with other routines to add/delete data values or children
nodes.
EXAMPLE
The following example creates a new node from the root node.
Blt_Tree token;
Blt_TreeNode root, node;
if (Blt_TreeGetToken(interp, "myTree", &token) != TCL_OK) {
return TCL_ERROR;
}
root = Blt_TreeRootNode(token);
node = Blt_TreeCreateNode(token, root, "myNode", -1);
NOTIFICATIONS
Blt_TreeCreateNode can trigger tree notify events. You can be notified whenever a node is created by using the Blt_TreeCreateNotifyHan-
dler. A callback routine is registered that will be automatically invoked whenever a new node is added via Blt_TreeCreateNode to the tree.
KEYWORDS
tree, token
BLT 2.4 Blt_TreeCreateNode(3)