LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-01-2004, 09:22 PM   #16
phoenix_fei
Member
 
Registered: Nov 2004
Location: shanghai
Distribution: worket
Posts: 41

Rep: Reputation: 15

I think if you user pointer you must do " new []" ,
for example
temp=new char[100];
 
Old 12-02-2004, 12:51 AM   #17
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
new[] is only for C++; you need malloc in C.
ta0kira
 
Old 12-04-2005, 09:01 AM   #18
clinux_rulz
Member
 
Registered: Nov 2005
Distribution: Gentoo
Posts: 51

Rep: Reputation: 16
Code:
// Since everyones having a go, heres mine.
// It does not require tempory storage, and it modifies the original string.
void deblank(char* str)
{
    int p = 0;
    while (*str != 0) {
        if (*str = ' ') {
            ++p;
        }
        *str = str[p];
        ++str;
    }
}

// clinux_rulz aka cj
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What is wrong with this C++ code? frankie_DJ Programming 5 10-01-2005 06:19 PM
What is wrong with this c code? qanopus Programming 3 06-02-2005 10:04 AM
What is wrong with this C code ? indian Programming 8 04-16-2005 04:42 AM
what ' s wrong in code ? phoenix_fei Programming 4 12-17-2004 12:32 PM
What is wrong with this code? qanopus Programming 4 03-12-2004 07:25 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration