I have got a stream of characters as input without any whitespaces, and I have to store them in a character array using scanf()
.
#include <stdio.h>
#include <iostream>
int main() {
int n,q,l,r,k;
scanf("%d",&n);
char A[n];
scanf("%d",&q);
for(int i=0; i<n; i++) {
scanf("%c",&A[i]);
}
for(int i=0; i<n; i++) {
printf("%c",A[i]);
}
return 0;
}
The above loop does not work.