[SOLVED] int main(int argc, char **argv[]) having trouble getting value out of array argv[ ] C programming.
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Thanks. I think they're more, but any would do at least for testing. If I were to actually post an application on the Apple Appstore, I could always replace them with a commercial version if it is affordable and looks much better.
that is like do not get caught in a casino doing that.
Depends where it is. In Atlantic City they can not throw you out for counting cards, as long as you're just using your mind, not any type of hidden device.
In Las Vegas, they can throw you out and ban you from ever playing blackjack there again.
I've read several books on it, and I just don't have the concentration to actually do it while playing a casino, I just want to drink and have fun!
Professional players don't drink or just sip on a light beer or something and rarely go to the same casino often, and if they win a lot, they usually get out fast before they garner attention.
Depends were it is. In Atlantic City they can not throw you out for counting cards, as long as you're just using your mind, not any type of hidden device.
In Las Vegas, they can throw you out and ban you from ever playing blackjack there again.
I've read several books on it, and I just don't have the concentration to actually do it while playing a casino, I just want to drink and have fun!
Professional players don't drink or just sip on a light beer or something and rarely go to the same casino often, and if they win a lot, they usually get out fast before they garner attention.
exactly - that too is why they now use more then one deck of cards now.
using one own mind it makes it harder to prove. BUT that casino - if it cannot figure out how someone is winning a lot and all of the time (taking their profits) then they can call "counting cards" and kick you out. Logically speaking of course. because what else can the accuse one of? luck has noting to do with it.
Thanks. I think they're more, but any would do at least for testing. If I were to actually post an application on the Apple Appstore, I could always replace them with a commercial version if it is affordable and looks much better.
yep. shouldn't be that hard to replace the images when it is all done and working properly.
exactly - that too is why they now use more then one deck of cards now.
using one own mind it makes it harder to prove. BUT that casino - if it cannot figure out how someone is winning a lot and all of the time (taking their profits) then they can call "counting cards" and kick you out. Logically speaking of course. because what else can the accuse one of? luck has noting to do with it.
The people watching the tables from the cameras know how to count cards themselves, so they know the difference between a card counter and a lucky drunk!
Just to be clear, my program is just to practice the game and it will give you hints on what to do so you can learn. It is not meant to, or able to, help you illegally count cards in an actual game in a casino.
The key is how to adjust your bet. Card counters bet heavily when the shoe's count is in their favor while throttling down to the minimum bet when it is unfavorable. That's how they can tell.
If you're betting a constant amount or seemingly randomly, then you're not counting cards.
in programs I'd think that it would develop a pattern eventually that one if watching it in how it does things if played long enough should see because random is not random using RANDOM seed. etc. But to use a card game to learn how to count cards, I never thought of that until now. all because of you! you have corrupted my mind. lol
in programs I'd think that it would develop a pattern eventually that one if watching it in how it does things if played long enough should see because random is not random using RANDOM seed. etc. But to use a card game to learn how to count cards, I never thought of that until now. all because of you! you have corrupted my mind. lol
LOL
This actually shuffles the shoe in my code (borrowed from someone else on the Internet):
Code:
- (void)shuffle
{
NSUInteger count = [self count];
if (count <= 1) return;
for (NSUInteger i = 0; i < count - 1; ++i) {
NSInteger remainingCount = count - i;
NSInteger exchangeIndex = i + arc4random_uniform((u_int32_t )remainingCount);
[self exchangeObjectAtIndex:i withObjectAtIndex:exchangeIndex];
}
}
It is Objective-C but shouldn't be too difficult for anyone to read.
This actually shuffles the shoe in my code (borrowed from someone else on the Internet):
Code:
- (void)shuffle
{
NSUInteger count = [self count];
if (count <= 1) return;
for (NSUInteger i = 0; i < count - 1; ++i) {
NSInteger remainingCount = count - i;
NSInteger exchangeIndex = i + arc4random_uniform((u_int32_t )remainingCount);
[self exchangeObjectAtIndex:i withObjectAtIndex:exchangeIndex];
}
}
It is Objective-C but shouldn't be too difficult for anyone to read.
returns pseudo-random pseudorandom-random numbers
pseudo being the key word -
arc4random_uniform being the developed one that gives a larger range to select as an output, therefore the chances of repeated same numbers is not lessened but rather extended before it happens again.
therefore increasing the chances of it not happening again until the mathematical equation used has the same values again.
4 can only be randomized so many way before the same numbers keep showing up.
using an algorithm for random numbers - increase the max number increases the changes of not getting the same number twice for a longer period of time.
it is because the "random" number is gotten form a mathematical algorithm it is therefore not random and a pattern arises.
Yes, but the implementation also collects truly random information from the keystrokes, mouse movements (or touch movements on an iPhone). According to Apple it's the best thing to use on their systems and is constantly updated as new technology makes it able to make the output even more random.
The man page is here (look at History section):
Code:
ARC4RANDOM(3) BSD Library Functions Manual ARC4RANDOM(3)
NAME
arc4random, arc4random_buf, arc4random_uniform -- random number generator
SYNOPSIS
#include <stdlib.h>
uint32_t
arc4random(void);
void
arc4random_buf(void *buf, size_t nbytes);
uint32_t
arc4random_uniform(uint32_t upper_bound);
DESCRIPTION
These functions use a cryptographic pseudo-random number generator to generate high quality
random bytes very quickly. One data pool is used for all consumers in a process, so that con-
sumption under program flow can act as additional stirring. The subsystem is re-seeded from
the kernel random number subsystem on a regular basis, and also upon fork(2).
This family of functions provides higher quality random data than those described in rand(3),
random(3), and rand48(3). They can be called in almost environments, including chroot(2) and
their use is encouraged over all other standard library functions for random numbers.
arc4random() returns a single 32-bit value.
arc4random_buf() fills the region buf of length nbytes with random data.
arc4random_uniform() will return a single 32-bit value, uniformly distributed but less than
upper_bound. This is recommended over constructions like ``arc4random() % upper_bound'' as it
avoids "modulo bias" when the upper bound is not a power of two. In the worst case, this
function may require multiple iterations to ensure uniformity.
RETURN VALUES
These functions are always successful, and no return value is reserved to indicate an error.
SEE ALSO
rand(3), rand48(3), random(3), random(4)
HISTORY
The original version of this random number generator used the RC4 (also known as ARC4) algo-
rithm. In OS X 10.12 it was replaced with the NIST-approved AES cipher, and it may be
replaced again in the future as cryptographic techniques advance. A good mnemonic is ``A
Replacement Call for Random''.
BSD July 30, 2015 BSD
Yes, but the implementation also collects truly random information from the keystrokes, mouse movements (or touch movements on an iPhone). According to Apple it's the best thing to use on their systems and is constantly updated as new technology makes it able to make the output even more random.
The man page is here (look at History section):
yeah I read that already googled that function call to random. where is it stated keyboard etc used to collect -- interesting as it is.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.