Solved

referencing

Posted on 1997-04-05
1
202 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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…

707 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