Possible Duplicate:
Is array name a pointer in C?
#include <stdlib.h>
int main(int argc, const char *argv[])
{
char *b=(char*)malloc(sizeof(char)*50);
b=(char*)"hello world";
// works
char a[50];
a=(char*)"hello world";
//doesn't work. why? I thought array names are just pointers that point
//to the first element of the array (which is char). so isn't a char*?
return 0;
}
I think the reason it doesn't work is because there's no variable called "a" that actually stores a char* value. so should 'a' be considered an rvalue? I'm not sure if I'm understanding the concept correctly