Pointer to function

Asked

Viewed 79 times

3

I would like to ask a question that is best left with an example:

I have the following piece of code in C:

char texto[]="String";
int (*ret)() = (int(*)())texto;

In this section above, I saw that a pointer is declared to function called Ret, but I did not understand what is assigned to it.

Would it be a casting? Like, he gets the address of texto[] and converts it to a function?

  • I don’t get it, it sounds like you’re asking someone specifically.

  • Sorry, I had never posted here kkkkkkk

  • @user39224 as Bacco said: from a walk by Tuor, you will find out how the site works won medals and managed to answer more questions still!

  • @user39224 I edited your question to be more suitable to the format of the site, but it is recommended to read the documentation here: [Tour] and [Ask] so that in the next (or even if you want to edit this question) you can better elaborate the post.

  • Thank you, I will read yes.

  • 1

    @user39224 besides reading the topics mentioned, register and come to be part of the community, we have much to learn and you will not miss with it :)

  • 1

    Can you give a functional example of this? Can you post code with more context? Where did you find this? Have a look at http://answall.com/help/mcve

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.