c - take char input and store it in an array -
i want take n number of inputs , save in arrays c[] , p[] , later use them...
i have written this,but i'm not getting desired output
#include<stdio.h> #include<stdlib.h> int main() { int n,t,i,j,size=0; char s[100000]; char c[100]; char p[100]; scanf("%d", &n); for(i=0;i<n;i++) { scanf("%c", &c[i]); scanf("%c", &p[i]); } for(i=0; i<n;i++) { printf("%c %c", c[i],p[i]); } return 0; }
considering second comment: "i want 4 w r 2 9 f g q t c should store w2fq , p should store r9gt ",
should change for(...)
loop for(i=0;i<n/2;i++)
Comments
Post a Comment