[ create a new paste ] login | about

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

C, pasted on Jan 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.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 2: error: expected declaration specifiers or '...' before 'va_list'
In function 'f':
Line 4: error: 'ap' undeclared (first use in this function)
Line 4: error: (Each undeclared identifier is reported only once
Line 4: error: for each function it appears in.)
In function 'b':
Line 9: error: 'va_list' undeclared (first use in this function)
Line 9: error: expected ';' before 'ap'
Line 10: error: 'ap' undeclared (first use in this function)
Line 11: error: expected expression before 'int'
Line 12: error: too many arguments to function 'f'


Create a new paste based on this one


Comments: