Solved

referencing

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to convert c++ code to Android App 3 83
Best book to learn C++ 4 70
Microsoft C++ code failing in executable that worked 9 85
Why isn't object file created? 6 43
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
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 goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

867 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

21 Experts available now in Live!

Get 1:1 Help Now