This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Pass 1 dimensional array in function

Passing any arrays by value or pointer does not work very well.

I can try integrating an array into a structure, but that is not how I would do it.

if I have: frame( unsigned char &mbrtubuf, int &uslen) and the receiving side is :

frame ( unsigned char *somepointer, and int *uslen) neither of the variables are passed

correctly to the function. Prototype is in a header file. Does not work and when it does work

its becomes unstable. Terrible compiler. It should work and I should even have to think

about it. I spend more time on the Compiler then I do on the actual program.

The only way I can get the array into a fucntion is by declaring it external in the function.

Any ideas

Phil

Parents
  • No! As already pointed out, you do not need that!

    See: c-faq.com/.../extern.html

    Therefore, this is not what "fixed" your problem.

    In general, when you don't know what "fixed" a problem, you should assume that it is not fixed; you have probably just (temporarily) masked the symptoms - not fixed the cause.

    "This might also solve some other issues I had with function pointers but that is another topic all together."

    Highly unlikely!

    As already noted, there are far more fundamental issues with function pointer in C51.
    Have you studied those issues yet?

    "my biggest problem is learning what tools work"

    It sounds much more likely that your biggest problem is that you are trying to build a large project without having first grasped the basics of 'C' programming.

    You really need to lay solid foundations before building the upper storeys of the house!

    The tools work - but you have to spend time learning how to use them correctly & effectively.

    "Is there a file that would show memory locations and how they are linked?"

    Yes - it is called the Linker Listing or "map" file.

Reply
  • No! As already pointed out, you do not need that!

    See: c-faq.com/.../extern.html

    Therefore, this is not what "fixed" your problem.

    In general, when you don't know what "fixed" a problem, you should assume that it is not fixed; you have probably just (temporarily) masked the symptoms - not fixed the cause.

    "This might also solve some other issues I had with function pointers but that is another topic all together."

    Highly unlikely!

    As already noted, there are far more fundamental issues with function pointer in C51.
    Have you studied those issues yet?

    "my biggest problem is learning what tools work"

    It sounds much more likely that your biggest problem is that you are trying to build a large project without having first grasped the basics of 'C' programming.

    You really need to lay solid foundations before building the upper storeys of the house!

    The tools work - but you have to spend time learning how to use them correctly & effectively.

    "Is there a file that would show memory locations and how they are linked?"

    Yes - it is called the Linker Listing or "map" file.

Children