| | |
Do variable names affect a program?
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
it's really frustrating to be looking in my textbook and see something like
I would change it to something like
that way I know what the heck I am doing! does this negatively impact my program in a) an insignificant way, b) a huge way, or c) not at all?
thanks!
p.s. haha i'm a junior techie that sounds just terrible :cheesy:
C Syntax (Toggle Plain Text)
void apd(vector& a, int j, int n) for (j = vector[a]; n > j; j--) j++;
I would change it to something like
C Syntax (Toggle Plain Text)
void functionName(vector& theArray, int position, n target)
that way I know what the heck I am doing! does this negatively impact my program in a) an insignificant way, b) a huge way, or c) not at all?
thanks!
p.s. haha i'm a junior techie that sounds just terrible :cheesy:
You are somebody, just as I am somebody... but in the end, when you REALLY think about it, we are all nobody...
Just be sure you have int target and not n target
If anything, it's good code practice to use descriptive variable names.
If anything, it's good code practice to use descriptive variable names. Dani the Computer Science Gal 
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
I am not sure, but what i get from SelArom's post is that he wants to know if a variable name has any impact on the program i.e if i use
int this_is_just_for_fun_and_to_waste_ur_precious_time;
instead of
int a;
and do so for over a hundred variable that i might have in my program--will it make any difference?
int this_is_just_for_fun_and_to_waste_ur_precious_time;
instead of
int a;
and do so for over a hundred variable that i might have in my program--will it make any difference?
"He who mixes with people and endures the harm they do is better than he who does not mix and endures." (Tirmidhi)
Variable names make a difference in how easy your program is to maintain and how many bugs you'll introduce writing it.
They'll also affect the way your colleagues will treat you, whether you'll get a pizza or a one way trip out the 3rd floor window during the next crunch session :eek:
They won't matter a thing after the compiler is through with it.
They'll also affect the way your colleagues will treat you, whether you'll get a pizza or a one way trip out the 3rd floor window during the next crunch session :eek:
They won't matter a thing after the compiler is through with it.
•
•
•
•
Originally Posted by jwenting
Variable names make a difference in how easy your program is to maintain and how many bugs you'll introduce writing it.
They'll also affect the way your colleagues will treat you, whether you'll get a pizza or a one way trip out the 3rd floor window during the next crunch session :eek:
They won't matter a thing after the compiler is through with it.
oh and yeah, I would use int target, not n target, lousy keyboard it was his fault. the code segment wasn't exactly from the book, I kinda jumbled it together to show you how hard it is for me to follow when they don't use damn descriptive variable names. I spend enough time in front of the computer without having to think of an example that makes logical sense
thanks again!!
You are somebody, just as I am somebody... but in the end, when you REALLY think about it, we are all nobody...
one letter variables can be helpful, for example as loop iterators where they really have no meaning except as a simple counter and have a very limited lifespan (when you use for (int i=0;i<10;i++) everyone knows what i does, when you declare int i asa a global and first use it 100 lines later it get hard to read).
•
•
•
•
Originally Posted by jwenting
one letter variables can be helpful, for example as loop iterators where they really have no meaning except as a simple counter and have a very limited lifespan (when you use for (int i=0;i<10;i++) everyone knows what i does, when you declare int i asa a global and first use it 100 lines later it get hard to read).
You are somebody, just as I am somebody... but in the end, when you REALLY think about it, we are all nobody...
![]() |
Other Threads in the C Forum
- Previous Thread: writing a simple cat program
- Next Thread: sorting and functions/structures
| Thread Tools | Search this Thread |
#include * ansi append array arrays asterisks bash binarysearch centimeter changingto char character convert copyimagefile cprogramme creafecopyofanytypeoffileinc database dynamic execv feet fgets file floatingpointvalidation fork framework function getlogicaldrivestrin givemetehcodez grade gtkwinlinux hacking histogram ide inches include incrementoperators infiniteloop initialization input interest intmain() iso kernel keyboard kilometer license linked linkedlist linux list lists locate looping lowest matrix meter microsoft number oddnumber opendocumentformat openwebfoundation overwrite owf pdf pointer posix power probleminc process program programming radix recursion recv recvblocked research reversing segmentationfault sequential single socket socketprograming socketprogramming standard strchr string suggestions systemcall test testing threads turboc unix urboc user variable wab whythiscodecausesegmentationfault windowsapi






