#include<stdio.h>
#define CH char*;
int main(){
CH a,b;
printf("%d %d\n",sizeof(a),sizeof(b));
return 0;
}

here the o/p is 4 1. why isnt b also of type char*..??

Because that's how C works.

This:

char* a,b;

creates two variables. a is a char*, b is a char. They are NOT both pointers. If you want them both to be pointers:

char *a, *b;

A good example of why you should not declare multiple variables together, but better one per line / declaration statement.

Although, if you use a typedef instead of a macro your original code would work:

#include<stdio.h>

typedef char* CH;
int main()
{
    CH a,b;
    printf("%d %d\n",sizeof(a),sizeof(b));
    return 0;
}

Now we've defined a new type called CH, which is a char*, so now a and b are both of type char*.
Which might be what you were originally aiming for!
Personally, I try to avoid using typedefs as they tend to obfuscate code, making it harder to understand what is going on. But there are certain situations when you might want to use them!

Comments
Nice
This question has already been answered. Start a new discussion instead.