Hi Im brandnew to both this board as to programming C I tried to write this program
with redhat 6.2
#include <stdio.h>
#include <string.h>
main()
{
char str1[] ={ 'A',' ',
'S','T','R','I','N','G',' ',
'C','O','N','S','T','A','N','T','\0'};
char str2[] = "Another string constant";
char *ptr_str = "Assign a string to a pointer";
printf("The length of str1 is: %d bytes\n",strlen(str1));
printf("The length of str2 is: %d bytes\n".strlen(str2));
printf("The length of the string assigned to ptr_str is: %d bytes\n",strlen(ptr_str));
return 0;
}
and compile it in a executable with this command
gcc -Wall -o test test.c
this is my error
request for member 'strlen' in something not a structure or union.
Now I figured out that when i want to include the lib math.h I need to add -lm at the end of the commando, but I dont know what I need to add to include the string.h, I know its probably something real stupid. But I could find the answer anywhere