Article 4T026 callBack

callBack

by
subrahmaniam
from LinuxQuestions.org on (#4T026)
Hi,
Below is a program for call back function. no compilation errors. But not entering into call back function (mcancallBack).I set variable reason to 0. I am trying to test the interrupt based callback. I could not find the mistake in this . please guide me to resolve this issue.
Thanks and regards,
K Subrahmaniam

#include <stdio.h>
#include<unistd.h>
#include<stdlib.h>
typedef void (*CANFD_DataAppCallBack)( int reason);

typedef struct temp
{
CANFD_DataAppCallBack callBack;
} x;

static void mcancallBack(int reason)
{
printf("reason is %d\n",reason);
if(reason==0)
printf("This is callback\n");
}

int reason;
x *ptr;
int main()
{
ptr= calloc (1, sizeof(*ptr));
reason =0;
ptr->callBack=mcancallBack;
free(ptr);
return 0;
}latest?d=yIl2AUoC8zA latest?i=3mVp2vMX05k:176WTWLyhYI:F7zBnMy latest?i=3mVp2vMX05k:176WTWLyhYI:V_sGLiP latest?d=qj6IDK7rITs latest?i=3mVp2vMX05k:176WTWLyhYI:gIN9vFw3mVp2vMX05k
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments