fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. #define ARRAY_MAX 128
  6.  
  7. typedef struct node node;
  8. struct node
  9. {
  10. int key;
  11. char value[ARRAY_MAX];
  12. node *next;
  13. };
  14.  
  15. node* insert(node* start, char* vinput, int kinput)
  16. {
  17. node* temp = start;
  18. while((temp->next->key < kinput) && temp->next!=NULL) {
  19. temp=temp->next;
  20. }
  21. if(temp->key==kinput) {
  22. temp->key = kinput;
  23. return temp;
  24. } else {
  25. node* inputnode = (node*)malloc(sizeof(node));
  26. inputnode->next = temp->next;
  27. temp->next = inputnode;
  28. inputnode->key = kinput; /*error: incompatible types in assignment*/
  29. inputnode->value = vinput;
  30. return inputnode;
  31. }
  32. }
  33.  
  34.  
  35. node* makedict(char* vinput, int kinput)
  36. {
  37. node* temp = (node*)malloc(sizeof(node));
  38. temp->value = vinput;
  39. temp->key = kinput; /*error: incompatible types in assignment*/
  40. temp->next = NULL;
  41. return temp;
  42. }
  43.  
  44. int main()
  45. {
  46. return EXIT_SUCCESS;
  47. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘insert’:
prog.c:29:26: error: incompatible types when assigning to type ‘char[128]’ from type ‘char *’
         inputnode->value = vinput;
                          ^
prog.c: In function ‘makedict’:
prog.c:38:17: error: incompatible types when assigning to type ‘char[128]’ from type ‘char *’
     temp->value = vinput;
                 ^
stdout

Standard output is empty