Here\'s my code
#include
#include
int main(){
char pal[8] = \"ciaooaic\";
char pal1[7] = \"ciaoaic\";
int lenPa
1. You don't leave room for a null terminator, as you pass them to strlen(), therefore your code exhibits undefined behaviour -
char pal[8] = "ciaooaic";
char pal1[7] = "ciaoaic";
Leave a space for '\0'. Declare and initialize like this -
char pal[9] = "ciaooaic";
char pal1[8] = "ciaoaic";
2. And strlen() returns size_t not int , so write like this -
size_t lenPal = strlen(pal);
size_t lenPal1 = strlen(pal1);
and use %zu specifier to print both these variables.