Ad

Chapter - 12: Console Input-Output

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


Ad
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*/
Ad

© 2024 Garbage Valuegarbage value logo