im doing a little practice on pointers and am trying to make a program that uses arrays and pointers. it takes a character input from user and then gives us the character at a specific array we input. but its not working and doesnt even letme type the number of characters i want.
the source code i tried is as follows..
Code:
#include <stdio.h>
int main()
{
int l,b;
int i=0;
char *p;
char a[i];
p=a;
printf("enter the length of string:\n");
scanf("%d",&l);
printf("enter string:\n");
for (i=0;i<l;i++)
{
scanf("%c",&a[i]);
}
printf("enter the cell adress:\n");
scanf("%d",&b);
printf("%c",*(a+b));
return 0;
}