what will happen if you free a pointer twice after
allocating memory dynamically ?

Answers were Sorted based on User's Feedback



what will happen if you free a pointer twice after allocating memory dynamically ?..

Answer / zan

segmentation fault

Is This Answer Correct ?    19 Yes 10 No

what will happen if you free a pointer twice after allocating memory dynamically ?..

Answer / manoj

Nothing will happen. program will run fine.

Is This Answer Correct ?    6 Yes 3 No

what will happen if you free a pointer twice after allocating memory dynamically ?..

Answer / karnik ankit

segmentation fault will be created

Is This Answer Correct ?    4 Yes 9 No

Post New Answer

More C Interview Questions

What is build process in c?

0 Answers  


What are keywords in c with examples?

0 Answers  


Why is this loop always executing once?

0 Answers  


Explain what?s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?

1 Answers  


What are linked lists in c?

0 Answers  






"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks

0 Answers  


Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it?

3 Answers  


I need testPalindrome and removeSpace #include <stdio.h> #define SIZE 256 /* function prototype */ /* test if the chars in the range of [left, right] of array is a palindrome */ int testPalindrome( char array[], int left, int right ); /* remove the space in the src array and copy it over to the "copy" array */ /* set the number of chars in the "copy" array to the location that cnt points t */ void removeSpace(char src[], char copy[], int *cnt); int main( void ) { char c; /* temporarily holds keyboard input */ char string[ SIZE ]; /* original string */ char copy[ SIZE ]; /* copy of string without spaces */ int count = 0; /* length of string */ int copyCount; /* length of copy */ printf( "Enter a sentence:\n" ); /* get sentence to test from user */ while ( ( c = getchar() ) != '\n' && count < SIZE ) { string[ count++ ] = c; } /* end while */ string[ count ] = '\0'; /* terminate string */ /* make a copy of string without spaces */ removeSpace(string, copy, &copyCount); /* print whether or not the sentence is a palindrome */ if ( testPalindrome( copy, 0, copyCount - 1 ) ) { printf( "\"%s\" is a palindrome\n", string ); } /* end if */ else { printf( "\"%s\" is not a palindrome\n", string ); } /* end else */ return 0; /* indicate successful termination */ } /* end main */ void removeSpace(char src[], char copy[], int *cnt) { } int testPalindrome( char array[], int left, int right ) { }

0 Answers  


how to write a prog in c to convert decimal number into binary by using recursen function,

1 Answers  


Why main function is special give two reasons?

0 Answers  


Write a program for the following series: 1*3*5-2*4*6+3*5*7-4*6*8+.................up to nterms

5 Answers   Convex Digital,


How to write a code for reverse of string without using string functions?

0 Answers   TCS,


Categories