What would you like to do?

Can you write a function similar to printf?

already exists.

Would you like to merge this question into it?

already exists as an alternate of this question.

Would you like to make it the primary and merge this question into it?

exists and is an alternate of .

//program for myprintf using variable arguments
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
int compare(const void * var1,const void * var2)
{
if(*(int *)var1 > *(int *)var2)
{
return(0);
}
else{
return(1);
}
}

int myPrintf(const char * output ,...)
{
va_list arguments;
int stringlength,stringIndx;
char *s;
int d;
char c;
stringlength = strlen(output);
va_start(arguments,output);
for(stringIndx = 0;stringIndx < stringlength;stringIndx++)
{
if(output[stringIndx] == '%')
{
stringIndx++;
switch(output[stringIndx])
{
case 's': /* string */
s = va_arg(arguments, char *);
printf("%s\n", s);
break;
case 'd': /* int */
d = va_arg(arguments, int);
printf("%d\n", d);
break;
case 'c': /* char */
default:
/* need a cast here since va_arg only
takes fully promoted types */
c = (char) va_arg(arguments, char);
printf("%c\n", c);
break;
}
}
else{
printf("%c",output[stringIndx]);
}
}
}
void main()
{
unsigned int au32Nos[10] = {32,44.,55,66,11,8,9,7,9,10};
qsort(au32Nos,10,4,compare);

myPrintf(" %d %d %d %d %d %d %d %d %d %d",au32Nos[0],au32Nos[1],au32Nos[2],au32Nos[3],au32Nos[4],au32Nos[5],au32Nos[6],au32Nos[7],au32Nos[8],au32Nos[9]);
}
Thanks for the feedback!

How is the function of bile similar to that of soap?

Both are emulsifiers (both make fats and oils more soluble in water).  Both are amphipathic molecules (they contain a polar end and a non-polar end).     Bile helps the

What is use of printf?

printf() is a build-in function under the header file 'stdio.h' in a C programming language. In c++,the same function is accomplished by 'cout' . It is used to display strings

How is the function of NAD similar to NADP?

They both are types of organic molecules and both accept molecules during redox reactions,(shorthand for reduction-oxidation reaction).A redox reaction describes all chemical

What is mean of printf?

print means print, f means formatting or printf is a output statement function in the C run-time library example: printf ("the value of A is %d\\n", A);

What are the Similarities of descriptive writing and narrative writing?

They are similar because they both tell you something. Descriptive writing describes--so it's going to tell you how something looks, how a person walks into the room, what tha