LogiQuest
Back to Strings
13

What will be the output of the program?

#include <stdio.h>
#include <string.h>

int main(void) {
    char s[] = "racecar";
    int i = 0, j = (int)strlen(s) - 1, ok = 1;
    while (i < j) if (s[i++] != s[j--]) ok = 0;
    printf("%d\n", ok);
    return 0;
}
Medium

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.