Printf can be implemented by using __________ list.
Answers were Sorted based on User's Feedback
Answer / sagar arora
variable length argument lists,for more information checked
out in Dennis Ritchie book.u can write ur own printf.
| Is This Answer Correct ? | 6 Yes | 1 No |
Answer / navneet
using Variable length argument lists :
Let us see how
Use vprintf, vfprintf, or vsprintf.
Here is an "error" routine which prints an error message, preceded by the string "error: " and terminated with a newline:
#include <stdio.h>
#include <stdarg.h>
void
error(char *fmt, ...)
{
va_list argp;
fprintf(stderr, "error: ");
va_start(argp, fmt);
vfprintf(stderr, fmt, argp);
va_end(argp);
fprintf(stderr, "\n");
}
To use the older <varargs.h> package, instead of <stdarg.h>, change the function header to:
void error(va_alist)
va_dcl
{
char *fmt;
change the va_start line to
va_start(argp);
and add the line
fmt = va_arg(argp, char *);
between the calls to va_start and vfprintf. (Note that there is no semicolon after va_dcl.)
References: K&R II Sec. 8.3 p. 174, Sec. B1.2 p. 245; H&S Sec. 17.12 p. 337; ANSI Secs. 4.9.6.7, 4.9.6.8, 4.9.6.9 .
| Is This Answer Correct ? | 1 Yes | 0 No |
#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }
how to return a multiple value from a function?
Is this code legal? int *ptr; ptr = (int *) 0x400;
Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?
main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.
2 Answers Mentor Graphics, Microsoft,
void main () { int x = 10; printf ("x = %d, y = %d", x,--x++); } a. 10, 10 b. 10, 9 c. 10, 11 d. none of the above
How do you sort a Linked List (singly connected) in O(n) please mail to pawan.10k@gmail.com if u can find an anser...i m desperate to knw...
6 Answers Microsoft, MSD, Oracle,
How can u say that a given point is in a triangle? 1. with the co-ordinates of the 3 vertices specified. 2. with only the co-ordinates of the top vertex given.
Find your day from your DOB?
15 Answers Accenture, Microsoft,
Write a procedure to implement highlight as a blinking operation
what is the code of the output of print the 10 fibonacci number series