Solved

referencing

Posted on 1997-04-05
1
200 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

730 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