Pages

Friday, June 10, 2016

Storing New Line character (\n) as a user input data.


//Storing New Line character (\n) as a user input data.

#include<stdio.h>
int main()
{
char mydata[100];
printf("Enter your details: \n");
printf("Press * and Enter to exit input mode..\n");
scanf("%[^*]", mydata);
printf("%s", mydata);
 return 0;
}

Output of program

Enter your details:
Press * and Enter to exit input mode..
Hello
Student
*
Hello
Student



No comments:

Post a Comment