Your code has two main issues.
1.
With
movie = movielist[rand() % 25];
you attempt to assign movie(an array of 15 char, type char [15]) by a pointer to an array of 30 char (type char (*)[30]). This is not permissible in C. You cannot assign arrays.
Since you don't want to modify/change the movie titles/strings in the program, you don't need a two-dimensional array for movielist and an array for movie.
Use an array of pointer for movielist which point to string literals and a pointer for movie instead.
The pointer move you assign then by the value of one of the pointers in movielist.
2.
rand() needs a seed with srand(). Without that, rand() won't work properly. But you forgot that in your code.
A usual way is to provide a seed dependent upon the CPU clock time.
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <time.h> // for the time seed.
int main (void)
{
char const * movie;
char const * const movielist[] = {
"thalaiva","aruvi","sarkar","visvasam","veeram",
"mersal","bigil","kaithi","mahanadhi","papanasam",
"vishwaroopam","padayappa","thadam","indian",
"petta","kaala","psycho","comali","bahubali",
"saaho","enthiran","vettai","asuraguru","penguin",
"cocktai"
};
// initialize random seed.
srand(time(NULL));
movie = movielist[rand() % 25];
printf("%s", movie);
}
Side note:
void main() is not compliant to the C standard. Use int main (void).
strcpynot assignment as that is not how you copy a string. If you just want to reference the original string then use a char pointer (char *).mainfor areint main (void)andint main (int argc, char *argv[])(which you will see written with the equivalentchar **argv). See: C11 Standard - §5.1.2.2.1 Program startup(p1). See also: What should main() return in C and C++?conio.h, that makes your code 100% non-portable. (you don't use anything from that header in your code above) You can usegetchar()to hold the terminal window open on windows, instead ofgetch().