U.S. CitiesCity-Data Forum Index
Go Back   City-Data Forum > General Forums > Science and Technology > Computers
 [Register]
Please register to participate in our discussions with 2 million other members - it's free and quick! Some forums can only be seen by registered members. After you create your account, you'll be able to customize options and access all our 15,000 new posts/day with fewer ads.
View detailed profile (Advanced) or search
site with Google Custom Search

Search Forums  (Advanced)
Reply Start New Thread
 
Old 06-10-2011, 06:22 AM
 
1,465 posts, read 4,611,860 times
Reputation: 852

Advertisements

Quote:
Originally Posted by NJBest View Post
I thought that could have been a possibility as well. But the usage of "Select" in this case is odd, so I wasn't sure.

So I made the assumption that "Select" meant "set" and wrote it out in C:

int * Pointer;
*Pointer = 1; Kaboom. Where is *Pointer?

while (*Pointer < 10) Not needed, will never test true as *Pointer>5 will end loop first{
Pointer = *Pointer; //This line is obviously wrong. Indeed this is wrong. Will get a compile error in a strong type check compiler (such as C++). If it compiled and linked, the next line will kaboom
*Pointer++;
if (*Pointer > 5)
break;
}

Either I'm misinterpreting something, or the psuedocode has an error in it.
NJBest, I understand all you did was translate the original stuff to a reasonable language people can understand. I didn't make an attempt to follow the original stuff at all. So my comments are directed to the original post, it was just easier to follow your translation.

mjohnson, if NJBest did capture your intent properly, there are some basic things you are not understanding. One is the role of a pointer and the other is loop control.
Reply With Quote Quick reply to this message

 
Old 06-10-2011, 08:02 AM
 
1,475 posts, read 2,273,955 times
Reputation: 659
Quote:
Originally Posted by NJBest View Post
It could not be MyFavoriteAlien, because MyFavoriteAlien would be a variable, and not a pointer.
That is incorrect. In some languages you declare pointers without specifying "@". You tend to see implicit pointers in OO stuff.

Last edited by Rich_CD; 06-10-2011 at 08:15 AM..
Reply With Quote Quick reply to this message
 
Old 06-10-2011, 08:05 AM
 
1,475 posts, read 2,273,955 times
Reputation: 659
Quote:
Originally Posted by NJBest View Post
Either I'm misinterpreting something, or the psuedocode has an error in it.
I don't know what language the OP is using either. Even though I don't code anymore I'm fairly sure the code posted by the OP is basically *all* error.
Reply With Quote Quick reply to this message
 
Old 06-10-2011, 08:14 AM
 
1,475 posts, read 2,273,955 times
Reputation: 659
Quote:
Originally Posted by DowntownVentura View Post
...a reasonable language people can understand...
I disagree. C is *not* a language that people unerstand. It's a language that is full of much less than intuitive constructs. The average person would call it gibberish.

There are other languages that people actually can understand without having years of programming knowledge under their belt. Also, those languages can be more easily understood by code analyzers making advanced development tools easier to produce.

Code completion tools which can cut coding time down significantly are much easier to produce in better languages. Also, two way coding via visual design is easier to provide in stricter languages.
Reply With Quote Quick reply to this message
 
Old 06-10-2011, 08:35 AM
 
24,503 posts, read 35,974,381 times
Reputation: 12847
Quote:
Originally Posted by Rich_CD View Post
I disagree. C is *not* a language that people unerstand. It's a language that is full of much less than intuitive constructs. The average person would call it gibberish.

There are other languages that people actually can understand without having years of programming knowledge under their belt. Also, those languages can be more easily understood by code analyzers making advanced development tools easier to produce.

Code completion tools which can cut coding time down significantly are much easier to produce in better languages. Also, two way coding via visual design is easier to provide in stricter languages.
And I disagree with you. C/C++ is one of the most reasonable languages to use when trying to discuss algorithms and/or concepts. The reason for this is because the majority of computer scientists know this language. Java and C++ are the most common languages used at universities for data structures and advanced programming. Java uses the C syntax.

This thread is not for the "average person". It's clearly targeted towards computer scientists or knowledgeable programmers.

Anyways, this argument is not in line with the OPs question.
Reply With Quote Quick reply to this message
 
Old 06-10-2011, 08:45 AM
 
1,475 posts, read 2,273,955 times
Reputation: 659
Quote:
Originally Posted by NJBest View Post
The reason for this is because the majority of computer scientists know this language.

Java and C++ are the most common languages used at universities for data structures and advanced programming.

This thread is not for the "average person".

Anyways, this argument is not in line with the OPs question.
I said C is not a good language because it is terse and obscure. I'm not commenting on its "commonality". I said the average person would call it gibberish to support my statement.

Universities make money by selling classes. They will choose the language which leads to more class hours.

Right, the thread is not for the average person. That is why I stated that C is not a good language. The average person will not have a clue as to way it is or isn't a good language.

You're right this has gone off topic. But, it is the beginning of a great topic to discuss.
Reply With Quote Quick reply to this message
 
Old 06-10-2011, 09:20 AM
 
22,779 posts, read 26,643,393 times
Reputation: 14580
Quote:
Originally Posted by NJBest View Post
Almost, but not quite accurate. You should clear it up so it's not confusing to the OP.
that is my understanding of what a pointer is; i use python so i don't have much experience with them, it just looked like his question wasn't being addressed. feel free to clear up anything you thought was inaccurate.
Reply With Quote Quick reply to this message
 
Old 06-10-2011, 10:24 AM
 
13,072 posts, read 11,578,849 times
Reputation: 2608
C/C++ really is the best language for explaining pointers (that or Assembly).

Anyway, here is an explanation that breaks it down nicely.

C++ : Understanding pointers

And how it works concerning assembly

http://www.formboss.net/blog/2010/12...s-in-assembly/

No offense to the OP, but you really should spend a little more time searching for the information. You can find thousands of examples on the concept of pointers doing a simple Google.
Reply With Quote Quick reply to this message
Please register to post and access all features of our very popular forum. It is free and quick. Over $68,000 in prizes has already been given out to active posters on our forum. Additional giveaways are planned.

Detailed information about all U.S. cities, counties, and zip codes on our site: City-data.com.


Reply
Please update this thread with any new information or opinions. This open thread is still read by thousands of people, so we encourage all additional points of view.

Quick Reply
Message:

Over $104,000 in prizes was already given out to active posters on our forum and additional giveaways are planned!

Go Back   City-Data Forum > General Forums > Science and Technology > Computers
Similar Threads
Follow City-Data.com founder on our Forum or

All times are GMT -6. The time now is 10:18 PM.

© 2005-2019, Advameg, Inc. · Please obey Forum Rules · Terms of Use and Privacy Policy · Bug Bounty

City-Data.com - Archive 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 - Top