Mega Code Archive

 
Categories / C / Code Snippets
 

Add format to scanf

#include <stdio.h> int main(void) { int x, j; printf("Enter an integer: "); scanf("%3d %d", &x, &j); printf("%d %d", x, j); return 0; }