Solved

called object is not a function

Posted on 2006-07-16
6
3,251 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
6 Comments
 
LVL 5

Expert Comment

by:dennis_george
Comment Utility
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
Comment Utility
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
Comment Utility
Compiler assumes that following syntax is a function
(txt[l] != '\r')  (txt[l] != '\n')   and hence the error.
0
 

Author Comment

by:sudarshantk
Comment Utility
Thanks
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

728 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

11 Experts available now in Live!

Get 1:1 Help Now