Hi everyone
I an trying to get the size of a string that is being held inside a variable defined as a pointer, I keep getting either one or two from the following code, where as I want to get 11 (number of letters in “hello world”)
Can someone help me out please,
many thanks
David
Code:#include <stdio.h> #include <stdlib.h> int size = 0; char *message; int main() { message = "hello world"; size = sizeof(message); printf("size: %i", size); return 0; }