Skip to content
Advertisement

Tag: casting

C code about pointers

I’ve got this simple code that plays with pointers taken from Jon Eriksen’s book that I’m trying to compile but gcc gives me warnings in compilation and segmentation fault (core dumped) when I run it. Output: Answer This program is wrong, and the advice given in the book is obviously wrong, too. A pointer can be converted to an integer

C assembler function casting

I came across this piece of code (for the whole program see this page, see the program named “srop.c”). My question is regarding how func is used in the main method. I have only kept the code which I thought could be related. It is the line *ret = (int)func +4; that confuses me. There are three questions I have

Advertisement