Checking if a string is a palindrome
You can't really call a difference of 1% slower or faster. You should consider that both codes have exactly the same performance.

The only explanation for a speed difference between those two applications comes from the malloc (which is slightly slower than an array).

IMO, first code is better than second; the second one is quite hard to get (you are basically reversing a string, then comparing the reversed string with the normal one). I actually had to read the code 3 times to understand what was done.

About code review in itself:


First code sample:

You should indent your code in a consistent manner.

int c,flag = 0;
char *ch, *h;


Those variables are poorly named; flag could be replaced by is_palindromic, h could be string_start/str_start/str, and ch string_from_end/string_reverse etc....

while((c=getchar())!=EOF){


It's usually a good idea to separate comparators and equal sign from their operands, so it'd be something like this:

while((c = getchar()) != EOF){

Second code sample:

char a[100],b[1000];
int n,i,j=0,f=0;


Same as before, you should also avoid declaring 4 variables on the same line (especially considering you have both initialized and non-initialized variables).