Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whats the difference between float* varname and float *varname in classic c

Tags:

c

syntax

What's the difference between float* varname and float *varname in classic C?

like image 363
acheo Avatar asked Jan 24 '10 22:01

acheo


1 Answers

Formatting. That's it. They mean the same thing.

Where you put the space (or if you even have one, really) is a matter of preference. Some prefer the * next to the varname so that you don't get confused by something like:

float* a, b;

(here, only a is a pointer, b is not)

Others argue that they never declare multiple variables at once, so they prefer the * next to float, since it's part of the type.

like image 198
Laurence Gonsalves Avatar answered Sep 19 '22 19:09

Laurence Gonsalves