Can anyone explain this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone explain this code

#include <stdio.h> int func(){ return (printf("hello world")); } int main() { printf("%d\n",sizeof(func)); return 0; }

14th Nov 2019, 11:35 AM
Preity
Preity - avatar
3 Answers
+ 7
Every function has an address so &func will have size 8
14th Nov 2019, 1:35 PM
Saurabh B
Saurabh B - avatar
+ 6
~ swim ~ Also can you tell why &func is giving 8?
14th Nov 2019, 1:22 PM
Avinesh
Avinesh - avatar
+ 6
14th Nov 2019, 1:53 PM
Avinesh
Avinesh - avatar