Quantcast
Channel: User Nicholas Knight - Stack Overflow
Viewing all articles
Browse latest Browse all 40

Answer by Nicholas Knight for What is the relationship between C and C++ (more technical approach)

$
0
0

C libraries are used in C++ constantly. Sometimes they get wrapped in a nicer idiomatic C++ interface, sometimes not. Lots of thin C++ wrappers around C socket APIs, for example, but people often use sockets directly anyway. I directly use various POSIX functions in C++ all the time.

You do need to make sure you already understand C, though (the number of new C++ programmers who try to pass C++ strings directly to C functions expecting C-strings...). And it takes time to learn the best ways to do certain things (that C function that needs a pointer to an array of data? Just give it the address of the first element of your C++ vector, don't manually allocate/build a new array).


Viewing all articles
Browse latest Browse all 40

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>