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

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -