I am having the following problem in my C code on a UNIX Platform.
function1(short *a)
{
EXEC SQL begin declare section;
short a1;
EXEC SQL end declare section;
EXEC SQL fetch quey_cursor
into
:a1;
// More processing
*a = a1;
}
The problem is the program is exiting at this line
*a = a1;
and I am not able to get debugs.
I really appreciate any help
Thanks
You have to pass to function1() a valid pointer to a short for the assignment to *a to work. The error is in where function1() was called.
From your comment, you are not allocating memory for the pointer. So, when you try to dereference it as *a=a1
, it's crashing. Since, it's only a single pointer, you can simply declare and use it as:
function() {
short a;
function1(&a);
}
Notice the difference with declaration and argument passed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.