c - Why does result variable have to be declared as a pointer in the following code? -
#include <stdio.h> #include <stdlib.h> int main(void) { int input; char *result; printf("enter positive integer: \n"); fflush(stdout); scanf("%d",&input); result= ((input % 2) ? "odd":"even"); printf("%s", result); }
why result
variable have declared pointer in code?
so can point c-style string.
Comments
Post a Comment