| io/scanf2.c - Illustration af brugen af scan width ved læsning af en streng. | Lektion 11 - slide 22 : 31 Program 2 |
/* Illustrates use of scan width - reading a text string */
#include <stdio.h>
int main (int argc, char *argv []){
int scan_res;
char str[20];
printf("Enter a test string - at most 6 chars will be read\n");
scan_res = scanf("%6s", str);
printf("This string has been read: %s\n", str);
printf("scanf returned: %d\n", scan_res);
}