stdarg
stdarg
Question
- How does va_arg (and so on) implemented?
- What will happen if you call printf("%d", char)?
Answer
- Question 1:
- It is not implemented as a user program(not even in libc). It acts as if the C keyword
sizeof. At compiling time, this word will be parsed by the compiler and do something to implement its funciton. - Question 2:
printfuses va_arg to get all the arguments. If you write%d, then it will assume that the argument is an integer(of typeint). This may result in error because content is referenced by pointers.
posted on 2024-03-11 12:28 amazzzzzing 阅读(37) 评论(0) 收藏 举报
浙公网安备 33010602011771号