0
What is the difference between the 2 syntax of code. Wich one is correct 1 or 2.
Typedef struct element { Int val; Struct element *suivant }element; element *init (element * L) { L=NULL; Return L; } When we will call the function init in the main 1-- Int main(){ element *a; a= init(L) 2-- Int main(){ element *a; a= init(&L);
7 Answers
0
L is undefined. What is L there?
Function is getting a structure so its not primitive value so it it pass address normal way.. 1st suites but it may depend on L type also..
0
L is a pointer that point to the structure element.
0
In main? Not in function.
If structure pointer, 1st works.
0
No it shout be a=init(a)
0
Yes. That works and thats what I saying..
a is defined so
a = init(a) ; is fine. but a = init(L) error for L is undefined...
0
Is going to be a =init(a) or a =init(&a)
0
amal 01 correct syntax for passing struct pointer there in your code sample is
element *a;
init(a);