below is my code. i know its a very simple problem but i dont know why this code is not working. i simply want to count number of strings in my array but its always showing me a count 1.
#include<stdio.h>
#include<string.h>
int main()
{
char *str[]={"Bharti","Bharat","Akas"};
int a=PalindromeLengthPuzzle(str);
return 0;
}
int PalindromeLengthPuzzle(char* input1[])
{
//const char *mystr=input1;
int i;
int sarray= sizeof(input1)/sizeof(input1[0]);
printf("%s",input1[0]);
//int sarray=sizeof(mystr)/sizeof(mystr[0]);
//int x=sizeof(mystr[0]);
printf("%d",sarray);
//printf("%s",input1[1]);
/*for( i=0;i<sarray;i++)
{
printf("%s",input1[i]);
}*/
return 0;
}
Output of the above code is Bharti1
and it should be 3 instead of 1. Any help would be grateful.