I want to take n number of inputs and save it in the arrays c[] and p[] and later use them...
I have currently 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 from your second comment: "i want it to be like 4 w r 2 9 f g q t now c should store w2fq and p should store r9gt ",
you should change all the
for(...)
loop withfor(i=0;i<n/2;i++)
Use this
%s
is for string of characters. If you want to read only one character, you should use%c
.