Mega Code Archive

 
Categories / C / Code Snippets
 

Narrow down the input by setting scanf

#include <stdio.h> int main(void) { char str[100]; printf("Enter letters, anything else to stop\n"); scanf("%[a-zA-Z]", str); printf(str); return 0; }