ex
int clrscr(int,int);
int min(void)
{
int x=0,y=0,z=0;
printf("enter two number");
scanf("%d%d",&x,&y);
z=clrscr(x,y);
printf("%d",z);
while(!kbhit());
return 0;
}
int clrscr(int x,int y)
{
return x+y;
}
@Henri korpela & Hitesh vaghani I just want to use printf in place of clrscr then what lib function should I use to print data and string through stdout
> I jsut want to use printf() lib function as user defined function
> which function should I use to print data and string
printf() is a function, not a keyword. Like any other function, printf() too can be overloaded.
1 2 3 4 5 6 7 8 9 10
#include <cstdio>
usingnamespace std ;
int printf( int a, int b ) { return a+b ; } // another printf
int printf( int a, int b, int c ) { return a + b*c ; } // yet another printf
int main()
{
printf( "%s %d and %d\n", "the values are: ", printf(1,2), printf(3,4,5) ) ;
}
Though the principle of least surprise would imply that you should use a name other than printf() for your own functions.