how to add element in list c

[ad_1]

c list add element
// Create a list
List AuthorList = new List();

// Add items using Add method
AuthorList.Add("Mahesh Chand");  
append to list in c
void Append(Node *head, Node node){
	Node tmp = *head;
    if(*head == NULL) {
    	*head = node;
      	return;
    }
  	while(tmp->next != NULL){
    	tmp = tmp->next;
  	}
  	tmp->next = node;
  	return;
}
how to add element in list c
#include 
#include 

int main()
{
    int * numbers = malloc(6*sizeof(int));

    for(int ii = 0; ii < 6; ++ii) {
        numbers[ii] = 5;
    }

    numbers = realloc(numbers, 7*sizeof(*numbers));
    if(!numbers) {
        printf("Memory allocation failed, sorry dude!\n");
        exit(1);
    }

    numbers[6] = 7;

    for(int ii = 0; ii< 7; ++ii) {
        printf(
    }

    free(numbers);
}

[ad_2]

Please follow and like us:
Content Protection by DMCA.com