Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char str1[15];
- printf("enter your first name: ");
- //scan your name (less than 10 character)
- scanf("%s", str1);
- printf("when the value was scanned:\n");
- printf("%s\n\n", str1);
- //suppose the previous input was "tahmid"
- char name[15];
- name[0] = 't';
- name[1] = 'a';
- name[2] = 'h';
- name[3] = 'm';
- name[4] = 'i';
- name[5] = 'd';
- printf("when inserted manually: \n");
- printf("%s\n\n\n", name);
- printf("there are some garbage value when the input was inserted manually. why?\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement