problem using va_arg using stdarg.h

problem using va_arg using stdarg.h

Post by Avi Put » Thu, 20 Mar 2003 21:03:23



Platform: V5.1 732 alpha

Using gcc version 3.0.2

I am having a problem using va_arg function.

I am including the stdarg.h header file.

I perform the following:

void foobarfunction(const char* name)
{

  va_list ap;
  char* value;

  va_start(ap, name);

  value = va_arg(ap, char*);

  va_end(ap);

  printf("value = [%s] \n",(char*) value);

Quote:}

The program core dumps when I try to print out the contents.  Am I
using va_arg  incorrectly or I am missing a step?

Any help would be greately appreciated.

Thanks.

Avi