Solved

referencing

Posted on 1997-04-05
1
183 Views
Last Modified: 2010-04-10
I don't know if there is any problem on the script, but I cannot compile it successfully.
---------------------------------------
int search(char &term)
{  if (term == "a")   <---- here is the problem.
   { ...... }
}


int ssearch(char *a)
{  if (a[5] == "1")    <--- here is the problem
      return 0;
   else return 1;
}
Then is it possible to use the function ssearch by:
int x = ssearch(*name);
where *name is pointing to the string which I want to check.

Thanks in advance.
0
Comment
Question by:snap
1 Comment
 
LVL 5

Accepted Solution

by:
yonat earned 50 total points
ID: 1162599
"a" is a 2 charcters array: {'a', '\0'}.
You should instead write:
if (term == 'a')

(single quote instead of double quote)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now