amac
Aug 21st, 2001, 02:49 PM
I was wondering if someone that has used these and gotten them to work would help me out...
I found an example which works... but when I try to do it... it doesnt... I almost type exactly the same thing in the example and still nothing...
#include <stdio.h>
#include <stdarg.h>
int count ( int first, ... );
void main (void)
{
printf ("%d", count ( 1, 2, 3, 4, 5, 6 ) );
}
int count ( int first, ... )
{
int count = 1, i = 0;
va_list start;
va_start ( start, first );
while (1)
{
i = va_arg (start, int);
if (i != -1) count++;
else break;
}
va_end ( start );
return count;
}
This is how the example does it... by lookin at it... this should work... but doesnt.
Can anyone help?
I found an example which works... but when I try to do it... it doesnt... I almost type exactly the same thing in the example and still nothing...
#include <stdio.h>
#include <stdarg.h>
int count ( int first, ... );
void main (void)
{
printf ("%d", count ( 1, 2, 3, 4, 5, 6 ) );
}
int count ( int first, ... )
{
int count = 1, i = 0;
va_list start;
va_start ( start, first );
while (1)
{
i = va_arg (start, int);
if (i != -1) count++;
else break;
}
va_end ( start );
return count;
}
This is how the example does it... by lookin at it... this should work... but doesnt.
Can anyone help?