0

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 ?

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by rahul8590
1

Try including stdlib.h

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

Edited by gerard4143: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.