public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* function parameters
@ 2023-11-21  2:30 André Albergaria Coelho
  2023-11-21  6:05 ` Martin Uecker
  2023-11-21 11:42 ` Jonathan Wakely
  0 siblings, 2 replies; 3+ messages in thread
From: André Albergaria Coelho @ 2023-11-21  2:30 UTC (permalink / raw)
  To: gcc

[-- Attachment #1: Type: text/plain, Size: 430 bytes --]

Hello

#include <stdio.h>

void func(char *ptr) {
     printf("\n%i",sizeof(ptr));
}

int main(void) {
     char arr[10];
     printf("\n Sizeof arr %i",sizeof(arr));
     func(arr);

     return 0;
}

/* sizeof(arr) != sizeof(ptr), but they point to same thing. */


So problem. On main, arr has size 10, while on func, arr has size 8. But 
they are equal.


-- 
André Albergaria Coelho
andrealbergaria@gmail.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-21 11:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-21  2:30 function parameters André Albergaria Coelho
2023-11-21  6:05 ` Martin Uecker
2023-11-21 11:42 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).