Joined
Last Seen
0 Reputation Points
Unknown Quality Score
No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
0 Endorsements
Ranked #107.41K
I wrote the following code for testing the functionality of malloc() . The Code is compiled using GCC and executed with no errors. #include<stdio.h> #include<stdlib.h> int main(void) { char *str; str=(char*)malloc(4*sizeof(char)); printf("Enter string"); gets(str); if(sizeof(str)>4*sizeof(char)) {printf("Out of Memory"); free(str); str=NULL; } else{ printf("\nsring entered=\n"); while(*str) { printf("%c",*str); str++; } free(str); … |