place holder ?!!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

place holder ?!!!!

i wanted to ask what is a place holder when should i start to use i have used c++ for many projects and recently started python but i have only read the don't know when i should use that thing so according to google: In computer programming, a placeholder is a character, word, or string of characters that may be used to take up space until such a time that the space is needed but when i define a variable isn't it initialized and has its unique address and location and i have no problem calling it with the name i gave this place so why do people use this thing i called place holder

23rd Jan 2017, 11:53 PM
Moetz Mohamed
Moetz Mohamed - avatar
3 Answers
+ 1
place holders are mostly used in examples in Python to declare variables. They fill up the memory address and define the datatype since in Python you can't just declare a variable without initializing it because variables take their datatype from the assignment. Doing so would produce an error since the compiler won't understand what you mean. In C++ when you declare a variable, you don't have to initialize it -- you can just say int var; . But in Python, writing var only without an assignment like var = 'meow' won't be interpreted as a variable. Yes variables are unique. A variable is a name of a location in memory, therefore every variable is an address.
24th Jan 2017, 12:18 AM
Godji Fortil (iamgodji)
Godji Fortil (iamgodji) - avatar
0
but why does a place holder have to static in every programming languages for example the place holders are "spam" and "eggs" but in other languages like c++ it is "foo"
24th Jan 2017, 12:31 AM
Moetz Mohamed
Moetz Mohamed - avatar
0
Those are just jokes used to demonstrate methodologies. Spam and eggs are from the comedy series Monty Python and foo is part of foobar.
24th Jan 2017, 1:45 AM
Kevin Gilkey-Graham
Kevin Gilkey-Graham - avatar