Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- node_t* temp = (node_t*)malloc(sizeof(node_t));
- if(temp==NULL){
- return NULL;
- }
- temp->value=value;
- temp->next = NULL;
- return temp;
- if(list==NULL){
- return 1;
- }
- node_t* temp = init_node(value);
- if(temp == NULL){
- return 1;
- }
- temp->next = list->first;
- list->first=temp;
- list->size++;
- return 0;
- //////////////////
- //
- // Created by guillaume on 17.02.20.
- //
- #include <stdlib.h>
- #include <string.h>
- #include <stdio.h>
- int main(int argc, char* args[]){
- int int1 = atoi(args[1]);
- int int2 = atoi(args[3]);
- char* string = args[2];
- if(strcmp(args[2],"-eq")==0){
- return !(int1 == int2);
- }
- else if(strcmp(args[2],"-ge")==0){
- return !(int1>=int2);
- }
- else if(strcmp(args[2],"-gt")==0){
- return !(int1>int2);
- }
- else if(strcmp(args[2],"-le")==0){
- return !(int1<=int2);
- }
- else if(strcmp(args[2],"-lt")==0){
- return !(int1<int2);
- }
- else if(strcmp(args[2],"-ne")==0){
- return !(int1!=int2);
- }
- else{
- return -1;
- }
- }
- /////////////////
- #include <string.h>
- #include <stdlib.h>
- if(head==NULL){
- return NULL;
- }
- if(head->next != NULL && head->next->next==NULL){
- struct node* first = malloc(sizeof(struct node));
- memcpy(first,head, sizeof(struct node));
- first->next=NULL;
- return first;
- }
- struct node* current = head->next;
- int index = 1;
- struct node* tempPointer = (struct node*) malloc(sizeof(struct node));
- struct node* tempax = tempPointer;
- if(tempPointer==NULL){
- return NULL;
- }
- memcpy(tempPointer,head, sizeof(struct node));
- while(current != NULL){
- if(index%2 ==0){
- tempPointer->next=malloc(sizeof(struct node));
- memcpy(tempPointer->next, current, sizeof(struct node));
- tempPointer=tempPointer->next;
- }
- current = current->next;
- index ++;
- }
- return tempax;
- /////////////////////////
- node_t *node = malloc(sizeof(node_t));
- if(node==NULL){
- return -1;
- }
- node->value = val;
- if (q->size == 0) {
- node->next=node;
- q->tail=node;
- q->size=1;
- return 0;
- }
- else{
- node->next=q->tail->next;
- q->tail->next=node;
- q->size++;
- return 0;
- }
- int val=q->tail->value;
- if(q->size==1){
- free(q->tail);
- q->tail=NULL;
- q->size=0;
- return val;
- }
- node_t* node = q->tail;
- while(node->next!=q->tail){
- node = node->next;
- }
- node->next=q->tail->next;
- free(q->tail);
- q->tail=node;
- q->size--;
- return val;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement