Tuesday, 14 May 2013

6. Format for string input


6. /* Format for string input */
main()
{
char str[7];
clrscr();
printf("Enter a string ");
scanf("%4s",str);
puts(str); /* if the input is 'computer', the output is 'comp' */
getch();
}

No comments:

Post a Comment