From: "André Albergaria Coelho" <andre1coelho@outlook.com>
To: gcc@gcc.gnu.org
Subject: function parameters
Date: Tue, 21 Nov 2023 02:30:47 +0000 [thread overview]
Message-ID: <PR3P250MB0372D1C6EC3B11289DBBC13993BBA@PR3P250MB0372.EURP250.PROD.OUTLOOK.COM> (raw)
[-- 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
next reply other threads:[~2023-11-21 2:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-21 2:30 André Albergaria Coelho [this message]
2023-11-21 6:05 ` Martin Uecker
2023-11-21 11:42 ` Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PR3P250MB0372D1C6EC3B11289DBBC13993BBA@PR3P250MB0372.EURP250.PROD.OUTLOOK.COM \
--to=andre1coelho@outlook.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).