The program is fetching me the right output but still i am getting a warning

#include<stdio.h>
#include<string.h>
int main()
{
char *p,*q;
p=(char *)malloc(25);
q=(char*) malloc(25);
strcpy(p,"hello" );
strcpy(q,"hi");
strcat(p,q);
printf("%s",p);
}

Warning
test7.c: In function ‘main’:
test7.c:6: warning: incompatible implicit declaration of built-in function ‘malloc’

wat exactly is the problem ?

Try including stdlib.h

Also, you may want to put this at the end of the main function - return 0;

ohh totally forgot about that . thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.