Chapter - 12: Console Input-Output

Write down two functions xgets( ) and xputs( ) which work similar to the standard library functions gets( ) and puts( ).


D
Sections
1
Exercises
#include<stdio.h>

void xgets(char *str)
{
	scanf("%[^\n]s", str);
}

void xputs(char *str)
{
	printf("%s\n", str);
}

/*By putting [^\n] inbetween % and s in scanf() function
will cause the function to accept even string after enter 
has hit*/

© 2021 Garbage Valuegarbage value logo