I am having the above code and I am really confused about this. In the program if I say size = 5, it should take 5 characters but it actually takes only 2 inputs. Can you help me what is the problem with my character array?Code:# include <stdio.h> void main () { char chr[50]; int i,size; printf ("Enter the size of the array:\n"); scanf ("%d",&size); printf ("Enter the characters of the array:\n"); for (i=0; i<size; i++) scanf ("%c",&chr[i]); printf ("The characters of the array are\n"); for (i=0; i<size; i++) printf ("%c",chr[i]); }
Bookmarks