-2

Currently I am looking at some C code. The code was created to make a .dll for use in visual basic. As I was going through the usual rigor of linking a new c project in visual studio I came across something I haven't seen before. Here is an example:

BOOL WINAPI DLLMain(VEGETABLE Carrot, SOILTYPE Dirt, TOOLTYPE Spade)
{
    return TRUE;
}

int WINAPI initialize(myVar)
char* myVar;
{
    myCalc  = do_a_thing(myVar)
    return myCalc
}

The declaration of myVar as a char* is really the item in question here. My feeble google attempts haven't shown me anything like what I am seeing here. Is this simply an alternative way to perform type declarations, or is there something more interesting going on here?

Thanks!

Adam M.
  • 7
  • 3

1 Answers1

0

This is the old way, called a K&R style function definition.

It's very old, like pre-C89. You don't see or use it in newly written code.

Community
  • 1
  • 1
unwind
  • 391,730
  • 64
  • 469
  • 606
  • A quick follow up. Is it reasonable to expect something like visual studio to be ok with the "K&R style?" – Adam M. Nov 03 '16 at 15:20
  • @AdamM. Visual Studio only follows an ancient C standard so it'll probably be more ok with it than more modern compilers. – Art Nov 03 '16 at 15:24