Forum > General

how to convert this simple c code to pascal?

(1/2) > >>

billyb123:
its simple variable definition, not really experienced in pascal, whats the pascal variation of following c code?


--- Code: ---char *blabla[] =
{
    "qwerty",
    "asdfg",
    "message",
    "this is"
};

--- End code ---

so, i need blablab to be of type PPChar, how to define it to match the above?

molly:

--- Quote from: billyb123 on November 18, 2017, 01:36:05 am ---so, i need blablab to be of type PPChar, how to define it to match the above?

--- End quote ---
PPChar ?

Isn't it an array of PChar, as char  * is a pointer to a char (Pascal equivalent is PChar) and blabla[] is an array ?


--- Code: ---const
  blabla : array[0..3] of PChar = (
    'qwerty',
    'asdfg',
    'message',
    'this is'
  );

--- End code ---

billyb123:
i simplified the question.. i need PPChar in a certain function but will try to pass array of pchar to it (it is the same thing)..

molly:
In case PPChar is required then don't forget to close your array with a nil as that is th usual way to close such an array. Other then that, you should be good to go.

Leledumbo:

--- Quote from: billyb123 on November 18, 2017, 01:02:17 pm ---i simplified the question.. i need PPChar in a certain function but will try to pass array of pchar to it (it is the same thing)..

--- End quote ---
I assume your actual question is: "how to pass an array of pchar to a function expecting ppchar". In that case just pass @ArrayOfPChar[LowestIndex].

Navigation

[0] Message Index

[#] Next page

Go to full version