#include <stdio.h>
void add_element(char object[20], int price);
struct linked_list {
char object[20];
int price;
struct shopping_list *next;
};
struct linked_list list = {"car", 15000, NULL};
struct linked_list *last = &list;
int main() {
add_element("snake", 340);
printf("%s", list.object);
return 0;
}
void add_element(char object[20], int price) {
struct linked_list new_element = {object, price, NULL};
}
ERROR:
warning: initialization makes integer from pointer without a cast [enabled by default]
struct linked_list new_element = {object, price, NULL};
if I pass "snake" directly to struct linked_list new_element it works, but passing object it doesn't.