• Register
0 votes

Problem :

Looking for solution on bellow problem
assign searchresult with a pointer to any instance of searchchar in personname. hint: use strchr().
6 5 3
6,930 points

1 Answer

0 votes

Solution :

The strchr() function is used to find the first occurrence of a specified character in a string. 
The Syntax is char *strchr(char *str, int ch); 
The function strchr() searches str from left side to right side until the character ch is found or the terminating NULL character is found. 
If ch is found, a pointer to it is returned. 
If not, NULL is returned.

Further Readings:

9 7 4
38,600 points

Related questions

0 votes
1 answer 23 views
In C-check if char is in char array I am trying to check if a character belongs to a list/array of invalid characters. It comes from a Python background.) for c in string:      if c in invalid_characters:          #do stuff, etc How can I do it with a regular C character array?
asked Aug 27 sasha 1.2k points
0 votes
1 answer 5 views
let's imagine we have two classes A and B: from class A in private I create a vector of pointers to instances of B vector <B *> punt; How would you add pointers to instances of B in that vector? How would those pointers be removed from the vector? Like a normal ... (name); // assuming you have a constructor that assigns the name     punt.push_back (newB); ??? Thank you very much and greetings !
asked Aug 14 game 4.3k points
0 votes
1 answer 8 views
I know it sounds weird but I wanted to know if there is a possibility in C ++ to write the addresses that a dynamic array saves to a file so that you can read the file and use the saved addresses with other pointers. What would be the way to enter and remove the addresses of the file?
asked Aug 14 game 4.3k points
0 votes
1 answer 10 views
0 votes
1 answer 15 views
My problem to solve is this: Make a structure called student, in which you will have the fields: name, age, average and data will be requested from the user of how many students will enter and check which of them has the best average and print it, use pointers. I would ... struct Student {      char name [30];      int age;      average float; } student [nStudents], * studentPointer = student;
asked Aug 14 game 4.3k points