Announcements‎ > ‎

test

posted Mar 5, 2009, 5:28 AM by Unknown user
#include <stdarg.h>

int foo(char *fmt, ...) {
va_list ap;
int d;
int count=0;
char c, *p, *s;

va_start(ap, fmt);
while (*fmt)
switch(*fmt++) {
case '%':
if((*fmt) && (*(fmt) != '%'))
count++;
else if (*fmt)
fmt++;
break;
}
va_end(ap);
printf("%d", count);


va_start(ap, fmt);
va_end(ap);

return count;
}

int dup(char *v, ...)
{
va_list ap;
int d;
int count=0;
char c, *s;



va_start(ap, v);
va_end(ap);

}
int main()
{
char *p = "%d%s%d";
foo(p);
dup(p);

}
Comments