I have this question in my mind since few weeks and I'm unable to find an answer for it.
Let say that we have this code:
typedef struct s_data
{
int age;
char *name;
} t_data;
int main()
{
t_data someone;
if ((foo(&someone)) != 0)
printf("blablabla");
//....
return (0);
}
int foo(t_data *someone)
{
// Get data from internal memory by example
*someone = unjson("data.json");
if (someone == null)
return (-1);
return (0);
}
So now, back in the parent, the object, the structure is updated, but how does it works if it's not a structure with a pointer, but an object? Like in C#
I pass my object, define that someone = unjson("....");
, the object is update in the child, not in the parent. It makes sense to me and it's logic, but how can you make it works as the example I gave in C for a language as C#?
Maybe this question is stupid, maybe I didn't searched with the right key-words en google, but I really wanna know how can I do it.
Thank for any explanation !