We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 55f4c53 commit 25d5335Copy full SHA for 25d5335
problem35
@@ -0,0 +1,27 @@
1
+Solution by Pavithra B, 111712205071, IT dept.
2
+
3
4
+Actually this creates 50 bytes which may cause memory leak. therefore after printing p, we should free the variable p and q(i.e.. free(p),free(q)).
5
6
+It may cause ExitFailure 9 which may arise due to memory exhaution
7
8
+correct code:
9
10
+#include<stdio.h>
11
+#include<string.h>
12
+main()
13
+{
14
+char *p,*q;
15
+p=(char *)malloc(25);
16
+q=(char*) malloc(25);
17
+strcpy(p,"amazon" );
18
+strcpy(q,"hyd");
19
+strcat(p,q);
20
+printf("%s",p);
21
+free(p);
22
+free(q);
23
+return 0;
24
+}
25
26
+Output:
27
+amazonhyd
0 commit comments