if array has size 5 and we have put only 2 or 3 integer values then how we could run a loop till the values we entered in C?Actually i am making program in C where i need to run a loop till the number of elements we have in array?
void main()
{
char a[]="this is a man";
int b[5],j=0,q;
int p= sizeof(a)/sizeof(a[0]);
for(int i=0;i<=p;i++)
{
if(a[i]=='i')
{
b[j]=i; j++;
}
}
for(int k=0;k<=5;k++)
{
printf("value %d\n",b[k]);
}
}