• 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

Please log in or register to answer this question.

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 92 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, 2020 sasha 5.3k points
0 votes
1 answer 7 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, 2020 game 4.6k points
0 votes
1 answer 13 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, 2020 game 4.6k points
0 votes
1 answer 16 views
Problem: My problem is the following: I have a class Nodo, which has as an attribute an array of pointers toto its same type (as to make a tree) and then I have a child class NodoAvlthat must inherit that attribute but the pointers must point to the same type , that is, point to NodoAvl. ... = T ()): Node <T> (data) {} int altu () {return alt;} }; Is there a way to do this? Thanks in advance.
asked Jan 1 sasha 5.3k points
0 votes
1 answer 12 views
0 votes
1 answer 94 views
Problem: I am wondering how can I determine the size of the array in some of the cases. I have written the below small sample program to illustrate what I am trying to say. int main(int argc, char *argv[]) {     std::vector<unsigned char>v;     unsigned char p[1024 ... return 0; } So I want to know the some or the other way to tell a vector how many elements it currently is supposed to be holding.
asked Jul 21, 2020 Raphael Pacheco 4.9k points
0 votes
2 answers 1.6K views
Problem : I got following rather cryptic error message: the truth value of an array with more than one element is ambiguous. use a.any() or a.all()
asked Nov 18, 2019 peterlaw 6.9k points
0 votes
1 answer 24 views
Problem Hello Kodlogs, I am working on creating a simple search with php but so far no success. I have tried code snippets on internet but they are not complete. They available code only shows how to troubleshoot. I am looking for complete code including PHP. HTML and CSS. Can you help?
asked Oct 30, 2020 hashq 1.1k points
0 votes
1 answer 34 views
Problem: I am making a program which consists of solving a 2x2 equation, for this I used the Cramer method, the problem is not how to solve it, but it throws an error when executing it, and I suspect that it is because I used methods of the Matrix class Inside the Vector class ... " using namespace std; int main () { cout << "As long as the program compiles well it is enough" << endl; return 0; }
asked Nov 5, 2020 sasha 5.3k points
0 votes
1 answer 18 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, 2020 game 4.6k points