Solved

called object is not a function

Posted on 2006-07-16
6
3,315 Views
Last Modified: 2008-03-03
Hi I am getting error in the following line....

int m=0;
for(l=0; txt[l] != '\0'; l++)
  {
      if((txt[l] != ' ') && (txt[l] != '\r')  (txt[l] != '\n'))
      {
            str[m]=txt[l];
          m++;
      }
  }
  str[l]='\0';

txt is of type const char *txt
char str[1000];

error message "called object is not a function "


0
Comment
Question by:sudarshantk
[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
6 Comments
 
LVL 5

Expert Comment

by:dennis_george
ID: 17119702
The following statement in your program is ill-formed....
if((txt[l] != ' ') && (txt[l] != '\r')  (txt[l] != '\n'))

each condition should be separated by a conditional statement....
e.g.
if( (txt[l] != ' ') && ((txt[l] != '\r') || (txt[l] != '\n'))  )

0
 
LVL 14

Expert Comment

by:cwwkie
ID: 17121313
should probably be and instead of or:

if( (txt[l] != ' ') && ((txt[l] != '\r') && (txt[l] != '\n'))  )

otherwise the whole statement would not make much sense.
0
 
LVL 3

Accepted Solution

by:
DineshJolania earned 125 total points
ID: 17239859
Compiler assumes that following syntax is a function
(txt[l] != '\r')  (txt[l] != '\n')   and hence the error.
0
 

Author Comment

by:sudarshantk
ID: 17453386
Thanks
0

Featured Post

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
How do I install gcc 4.8.4 on a Linux Ubuntu 14.04 machine? 5 2,174
An API detour question 7 103
Test the speeds on my PC Drives 12 71
Assignment from incompatible pointer type? 2 40
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

726 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