C pointers and malloc confusion between &str,str -


im beginner in c,in following code can output value of &str , str when cast integer.??

int main() {    char *str;     /* initial memory allocation */     str = (char *) malloc(15);     strcpy(str, "hello");     printf("string = %s,  address = %d ,val=%d\n", str, &str,str);      free(str);     return(0); } 

this output got:

string = hello, address = -1407247144 ,val=22335504


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -