In 6th line we have declared the type as char= *ptr=strtok(s," “);
whereas in 8th line we have not mentioned the data type of ptr as ptr=strtok(s,” ")
please sort this out.
and what does static array mean?
Problem related to code
@vikash3303 you only need to declare the variable ptr once.
Suppose you have a program like this
int a = 10;
a = 15;
now do you need to tell the compiler the datatype of a again and again ? no
so pointers are not any different either.
char *strtok(char *s, char *delim) sir is saying this strtok returns character pointer and it accepts character array and array of delimnator. “char *strtok” is character pointer and “char *s” as character array why…?
if ptr is pointing to the first token of the given array the it should return address of first token
in problem while(ptr!=NULL)then here ptr is encountering space i.e NULL then how loop is working
char *s; is pointer only
but if it contains the address of arr[0] then we can also treat it as array
because name of array is also a pointer which points to the first element of array
i think you have forgotten the pointer and array topic
revisit to that topic and revise them they are important
i don’t understand this question can you elobrate it??
space character is not the same as NULL. NULL is a special character with ASCII value 0.