Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reference variables in C++

Tags:

c++

c

reference

Why are reference variables not present/used in C?

Why are they designed for C++?

like image 267
Vijay Avatar asked Aug 10 '26 16:08

Vijay


1 Answers

Because C was invented first. I don't know if they hadn't thought about references at the time (being mostly unnecessary), or if there was some particular reason not to include them (perhaps compiler complexity). They're certainly much more useful for object-oriented and generic constructs than the procedural style of C.

like image 149
Cogwheel Avatar answered Aug 13 '26 05:08

Cogwheel