Search:

Type: Posts; User: omnificient

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. I appreciate your help, but your code often...

    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 =...
  2. What I actually want to achieve is that I want to...

    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...
  3. The const keyword makes a variable unchangable. I...

    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?
  4. Using pointer declared in other function, in main.

    Hello,

    I've got the following code:


    #include <stdio.h>
    void test();

    int main()
    {
  5. Replies
    7
    Views
    7,774

    Well I don't really understand what you're doing...

    Well I don't really understand what you're doing there rags_to_riches.
  6. Replies
    7
    Views
    7,774

    Finding a hyphen in an array.

    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;
  7. Replies
    2
    Views
    1,024

    Passing pointers.

    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)
    {...
  8. It works now. Thanks!

    It works now. Thanks!
  9. Function with if-statements not working.

    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
    }
  10. Replies
    6
    Views
    1,724

    Discrepancy using rand() and array.

    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...
  11. Replies
    3
    Views
    1,991

    I don't really understand the part: "write a...

    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...
  12. Replies
    3
    Views
    1,991

    Passing arguments.

    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])...
  13. Replies
    2
    Views
    1,219

    Weird output loop+array.

    I've got the following function:


    void deck()
    {
    int cards[14][4];
    int a;
    int b;
    for (b = 0; b < 4;b++)
    {
  14. Replies
    2
    Views
    1,125

    Thanks!

    Thanks!
  15. Replies
    2
    Views
    1,125

    Compiler error.

    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...
  16. Replies
    2
    Views
    1,558

    Checking the user input.

    What would be a simple way to see wether the user indeed inputs an int and not a char?

    Thank You.
  17. Replies
    5
    Views
    1,792

    Thanks for the suggestions. A little proof of...

    Thanks for the suggestions.
    A little proof of concept:


    #include <stdio.h>
    void function();

    int main()
    {
    int i;
  18. Replies
    5
    Views
    1,792

    I should be passing by adress and not by value to...

    I should be passing by adress and not by value to do this?
  19. Replies
    5
    Views
    1,792

    Calculator program.

    #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()...
  20. Thread: Functions.

    by omnificient
    Replies
    5
    Views
    933

    I'm working on it. The user should also be able...

    I'm working on it. The user should also be able to work with floating point numbers.
  21. Thread: Functions.

    by omnificient
    Replies
    5
    Views
    933

    Oops, I overlooked that.

    Oops, I overlooked that.
  22. Thread: Functions.

    by omnificient
    Replies
    5
    Views
    933

    Functions.

    I've written the following:


    #include <stdio.h>
    void multiply();

    int main()
    {
    int choise;
    printf("Calculator.\n");
  23. Replies
    29
    Views
    3,075

    I see how it works now. Thanks for the...

    I see how it works now. Thanks for the explanation.
  24. Replies
    29
    Views
    3,075

    So will the getchar() in the while statement is...

    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?
  25. Replies
    29
    Views
    3,075

    So that would mean using another getchar()? The...

    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?
Results 1 to 25 of 88
Page 1 of 4 1 2 3 4