C++ Features in C Tutorial

This is a discussion on C++ Features in C Tutorial within the C Programming forums, part of the General Programming Boards category; Seeing as I'm a newbie (the reason I'm reading the tutorial), I could be wrong, but I think Lesson 9 ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    129

    C++ Features in C Tutorial

    Seeing as I'm a newbie (the reason I'm reading the tutorial), I could be wrong, but I think Lesson 9 in the C tutorial uses C++-only features (new and delete) in its 4th and 5th code examples. My compiler (gcc) gives an error about 'new' being an undeclared identifier when I use the keyword as demonstrated in that lesson, and the FAQ labels both keywords "(C++)."

    Thanks!
    Last edited by Jesdisciple; 08-19-2008 at 11:36 AM.

  2. #2
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    Youre right they are C++ features. In c you use generally use malloc() and free() from stdlib.h instead. IIRC theres and article in the FAQ about how to use them.

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    129
    My purpose in posting (which I obviously forgot to mention) was that the error be corrected. But thanks for mentioning the alternatives.

  4. #4
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    Well I think the rest of the site has become a bit of a derelict wasteland. After all we still have links for farmsex floating around. Even tho I pointed it out over a year ago.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My new website
    By joeprogrammer in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 03-17-2006, 06:38 PM
  2. Cprog tutorial: Design Patterns
    By maes in forum C++ Programming
    Replies: 7
    Last Post: 10-11-2004, 01:41 AM
  3. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 08:40 PM
  4. Problem with tutorial (Vector class)
    By OdyTHeBear in forum C++ Programming
    Replies: 4
    Last Post: 12-18-2002, 01:49 PM
  5. My DirectInput tutorial....
    By jdinger in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 06-18-2002, 11:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21