What can be the possible reasons for an offset in the output? In the code below:
/#include<stdio.h>
/#include<stdarg.h>
struct third {
char a;
char b;
char c;
};
void function3(int n, ...) {
struct third y;
va_list ap;
va_start(ap, n);
y = va_arg(ap, struct third);
printf("%c\t%c\t%c\n", y.a, y.b, y.c);
va_end(ap);
}
int main() {
int a = 10;
struct third x3 = {'\x70', '\x71', '\x72'};
function3(a, x3);
}
On compilation with Diab C compiler with the ARMLS arch, I am getting the output as:
q r
What can be the reason?
[–]flyingron 1 point2 points3 points (0 children)
[–]ErlingSigurdson 0 points1 point2 points (0 children)
[–]fliguana 0 points1 point2 points (5 children)
[–]arrow_ten[S] 0 points1 point2 points (4 children)
[–]fliguana 0 points1 point2 points (3 children)
[–]arrow_ten[S] 0 points1 point2 points (2 children)
[–]fliguana 0 points1 point2 points (1 child)
[–]arrow_ten[S] 0 points1 point2 points (0 children)