So I’m working on an assignment in C-Language together with ChatGPT and it threw a code snippet at me, that is a bit confusing.
<code>int foo(<not-Primitive Datatype> *nP, <Primitive Datatype like int> *iP) {
if(bar(np, &iP) {
// Something, Something
}
}
</code>
<code>int foo(<not-Primitive Datatype> *nP, <Primitive Datatype like int> *iP) {
if(bar(np, &iP) {
// Something, Something
}
}
</code>
int foo(<not-Primitive Datatype> *nP, <Primitive Datatype like int> *iP) {
if(bar(np, &iP) {
// Something, Something
}
}
Is there a particular reason why in the function call to bar()
the nP
is stated directly and iP
needs the &
operator?
The only thing I can think of is because nP
is of a non-Primitive Datatype while iP
is primitive, however, this doesn’t really answers to my confusion as to why one of them needs the &
while the other doesn’t since both iP
and nP
are pointers themselves.