my code is not identifying type string. I am using c to program
CodePudding user response:
Parameter types are only put in function declarations, not function calls.
int letters = count_letters(string text);
should be
int letters = count_letters(text);
CodePudding user response:
C does not have a string
type.
Although in C you can use the types char *
and char[]
to store and manipulate array of characters and treat them like strings.
define a string like this:
char *x = "hello"; // cannot be edited treat as read only (in most cases)
char x[5] = "hello";
char[5] = {'h','e','l','l','o','\0'}; // character at end signifies end of string