I appreciate your help, but your code often contains concepts I don't understand. Why won't the following code work:
#include <stdio.h>
void test(char *green);
int main()
{
char *green =...
Type: Posts; User: omnificient
I appreciate your help, but your code often contains concepts I don't understand. Why won't the following code work:
#include <stdio.h>
void test(char *green);
int main()
{
char *green =...
What I actually want to achieve is that I want to return a string to the function main, and print it there. In my book I read the following example:
#include <stdio.h>
void peasoup(int...
The const keyword makes a variable unchangable. I don't see what it does to a function. Does it change the value returned by the function in a read only variable?
Hello,
I've got the following code:
#include <stdio.h>
void test();
int main()
{
Well I don't really understand what you're doing there rags_to_riches.
I'm trying to find out how to read a hyphen from an array. I've got the following set up:
#include <stdio.h>
int main()
{
char data[5];
int a = 0;
I'm sure I'm doing something wrong here. I can't figure out what tough.
This is the function that gives trouble:
void ten_and_up(int random, char *pjackEtc)
{
if (random == 11)
{...
It works now. Thanks!
I've come up with the following function to find out which type a card is.
char color(int random)
{
char colour;
if (random < 13)
{
colour = 'S'; //Spades
}
I've made the following function.
void select(int deck[52])
{
srand(time(NULL)); //Seeds the randomization
int random = rand() % 52; //Puts a random value in the variable random.
int...
I don't really understand the part: "write a function that does this operation on an array passed as argument"
How can I make a calculation with an array, that is array independant. I mean that it...
When I want to pass multiple arguments to a function, and do the same thing to all of these arguments, is there an easy way to do this?
void vul(ruiten[4], harten[4], klaver[4], schoppen[4])...
I've got the following function:
void deck()
{
int cards[14][4];
int a;
int b;
for (b = 0; b < 4;b++)
{
Thanks!
Hello,
When I compile a program I get the following error:
pim@zwart:~/C$ gcc Blakjack.c -o black
/tmp/cc4vhl2b.o: In function `main':
Blakjack.c:(.text+0x26): undefined reference to...
What would be a simple way to see wether the user indeed inputs an int and not a char?
Thank You.
Thanks for the suggestions.
A little proof of concept:
#include <stdio.h>
void function();
int main()
{
int i;
I should be passing by adress and not by value to do this?
#include <stdio.h>
#include <stdlib.h> //for exit function.
void multiply();
void divide();
void add();
void substract();
/* The floats should be changed maybe to be rounded off. */
int main()...
I'm working on it. The user should also be able to work with floating point numbers.
Oops, I overlooked that.
I've written the following:
#include <stdio.h>
void multiply();
int main()
{
int choise;
printf("Calculator.\n");
I see how it works now. Thanks for the explanation.
So will the getchar() in the while statement is not only used to check if something is true, but it will actually be presented to the user?
So that would mean using another getchar()? The problem that I then create is that the user now does have to press enter twice.
Maybe a while loop?