[ create a new paste ] login | about

Link: http://codepad.org/zWgJd1S9    [ raw code | output | fork ]

C, pasted on Jan 14:
#include <stdio.h>
#include <stdlib.h>

void f(const char *str, va_list ap)
{
vprintf(str, ap);
}

void b(int m, ...)
{
va_list ap;
va_start(ap, m);
int k = (int)va_arg(ap,int);
f("boo: ", ap);
va_end(ap);
}

int main()
{
b(2, 3, 4, 5, 6);
return 0;
}


Output:
1
2
3
4
5
6
7
8
9
10
11
Line 4: error: expected declaration specifiers or '...' before 'va_list'
In function 'f':
Line 6: error: 'ap' undeclared (first use in this function)
Line 6: error: (Each undeclared identifier is reported only once
Line 6: error: for each function it appears in.)
In function 'b':
Line 11: error: 'va_list' undeclared (first use in this function)
Line 11: error: expected ';' before 'ap'
Line 12: error: 'ap' undeclared (first use in this function)
Line 13: error: expected expression before 'int'
Line 14: error: too many arguments to function 'f'


Create a new paste based on this one


Comments: