Segmentation fault when returning a value on a different PC

F

francescomoi

Hi.

I've got a C program which calls a function:
----------------
printf("TEST1\n");
int value = my_function(param);
printf("TEST2\n");

int my_function(int my_param)
{
int internal_param = my_array[index];
printf("%d\n", internal_param); //it works ok
return internal_param;
}
 
G

Grumble

I've got a C program which calls a function:
----------------
printf("TEST1\n");
int value = my_function(param);
printf("TEST2\n");

int my_function(int my_param)
{
int internal_param = my_array[index];
printf("%d\n", internal_param); //it works ok
return internal_param;
}

Could you give the complete program you are compiling?
 
D

Default User

Hi.

I've got a C program which calls a function:
----------------
printf("TEST1\n");
int value = my_function(param);
printf("TEST2\n");

int my_function(int my_param)
{
int internal_param = my_array[index];
printf("%d\n", internal_param); //it works ok
return internal_param;
}


When you have trouble with your car, to take pieces of it in to the
mechanic, or the whole thing? You've shown us a part of your program,
probably not the part actually causing the problem. For instance, we
don't know what my_array, index, or param are. It's particularly
suspicious that you pass param in as an argument to my_param, then
never use my_param in the function.

Post a complete, minimal program that demonstrates the problem.



Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top