Search:

Type: Posts; User: Cela

Page 1 of 15 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    7
    Views
    1,247

    >>Is there an opposite working function to...

    >>Is there an opposite working function to strspn()?
    Yep, strcspn() :-)
  2. Replies
    7
    Views
    1,165

    >>i mean how can the foundation of c code be c...

    >>i mean how can the foundation of c code be c code? it couldnt of invented its self.
    A compiler can be written in C since all it does is parse a text file and convert it to an executable. The fact...
  3. Thread: parsing a number

    by Cela
    Replies
    1
    Views
    5,406

    :-) #include int main(void) {...

    :-)


    #include <stdio.h>

    int main(void)
    {
    int a = 12345;

    do
  4. Thread: stdin question

    by Cela
    Replies
    6
    Views
    2,869

    stdin is always open in your program unless you...

    stdin is always open in your program unless you do something unadvisable like fclose it :-)
  5. Thread: string functions?

    by Cela
    Replies
    6
    Views
    1,377

    If you have strrev, otherwise you can write your...

    If you have strrev, otherwise you can write your own really easily. This one is independent of any header files, meaning you don't need string.h :-)


    #include <stdio.h>

    static void...
  6. Replies
    12
    Views
    7,901

    >>But then you're not calculating them, your...

    >>But then you're not calculating them, your looking them up, which is a different thing altogether.
    Right, it's faster :-)
  7. Replies
    12
    Views
    7,901

    >>I need to write a program that determines if a...

    >>I need to write a program that determines if a number entered is prime or not.
    Get a list of known prime numbers, make a static array out of those numbers, then binary search that array when you...
  8. Replies
    7
    Views
    1,652

    >>I could possibl try doing it in perl, I put...

    >>I could possibl try doing it in perl, I put that in there in case anyone new how to do it in perl
    It's a piece of cake :-)


    #!usr/bin/perl -w

    use Errno qw(EAGAIN);

    FORK: {
    if ($pid =...
  9. >>$str1 = "^$a\\s+(b)(?:\\s+:\\s+$c\\s+$b)?\\s*";...

    >>$str1 = "^$a\\s+(b)(?:\\s+:\\s+$c\\s+$b)?\\s*";
    This pattern will match the following


    ax bx : cx d

    >>$str2 = "^$a\\s+(b)(?:\\s+:\\s+$c\\s+$b)?\\s*{";
    So will this one, see the...
  10. Replies
    9
    Views
    2,333

    >>would u know how to fix this problem? With...

    >>would u know how to fix this problem?
    With your restrictions you can't. If you enter a really large value then it'll overflow the unsigned variable and it'll probably be in range.
  11. Replies
    9
    Views
    2,333

    This sounds like an overly difficult assignment...

    This sounds like an overly difficult assignment to me, the best approximation I can come up with while maintaining the restrictions you have is this


    #include <stdio.h>

    int get_int(void)
    {
    ...
  12. >>scanf("%5.2lf", &sale_amount); Take out the...

    >>scanf("%5.2lf", &sale_amount);
    Take out the 5.2 and it'll work fine :-)
  13. Thread: integer problems

    by Cela
    Replies
    7
    Views
    1,277

    Oh, that's what you wanted to do :-) ...

    Oh, that's what you wanted to do :-)


    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <errno.h>
    #include <limits.h>

    unsigned int getInputData(){
  14. >>switch(x > y ? true : false) // or 1 : 0 Why...

    >>switch(x > y ? true : false) // or 1 : 0
    Why do that? Using a relational operator automatically returns true and false, it's redundant to do it explicitly :-)
  15. Thread: SizeOf function

    by Cela
    Replies
    4
    Views
    2,122

    >>would that still work in my function? Sure,...

    >>would that still work in my function?
    Sure, just paste it into your function and you're set :-)

    >>getData.c:14: warning: passing arg 1 of `printf' from incompatible pointer type
    It looks like...
  16. Thread: Help!

    by Cela
    Replies
    12
    Views
    1,486

    Add the bold stuff to your program :-) /*...

    Add the bold stuff to your program :-)


    /* Fig. 2.1: fig02_01.c
    A first program in C */
    #include <stdio.h>

    int main( void )
    {
    printf( "Welcome to C!\n" );
  17. Thread: SizeOf function

    by Cela
    Replies
    4
    Views
    2,122

    >>and i'm not too sure how to use the SizeOf...

    >>and i'm not too sure how to use the SizeOf Function, I need to use it to verify that an inputted integer is not greater than the maximun number of bytes allowed
    First things first, sizeof isn't a...
  18. Replies
    11
    Views
    3,839

    >>If you're going to check for HUGE_VAL, you...

    >>If you're going to check for HUGE_VAL, you might as well check for -HUGE_VAL too.
    Good point, but now that I think about it there's no reason to check for HUGE_VAL at all, since errno is set for...
  19. Replies
    11
    Views
    3,839

    That's a good point, I'll remember it :-) But...

    That's a good point, I'll remember it :-) But first, one nitpick about that quote

    >>This means that, even if you don't include the indicated header file
    The ANSI standard says that they're...
  20. Thread: fprintf

    by Cela
    Replies
    2
    Views
    1,350

    All you need to do is throw in something to...

    All you need to do is throw in something to remove the newline character from the input stream. When you put a char into mode, there were actually two keypresses, one for the char itself and one for...
  21. Replies
    11
    Views
    3,839

    >>Dude, you're not forgetting string is a...

    >>Dude, you're not forgetting string is a reserved name, are you?!
    Since when? :-) The ANSI standard says only that function names beginning with str and a lower case letter are reserved, it also...
  22. Replies
    11
    Views
    3,839

    :-) #include #include ...

    :-)


    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <math.h>

    int is_float(char *src, size_t len)
    {
  23. Thread: srand question

    by Cela
    Replies
    5
    Views
    1,335

    It's best to seed the generator only once in the...

    It's best to seed the generator only once in the program :-)
  24. Thread: strcpy

    by Cela
    Replies
    17
    Views
    4,461

    Well, first, strcpy doesn't work like you expect....

    Well, first, strcpy doesn't work like you expect. You can't copy a string to a simple pointer, there has to be space for it. Second, you can't copy strings with the assignment operator. Something...
  25. Replies
    4
    Views
    1,564

    >>but what is ADT? Abstract data type :-) ...

    >>but what is ADT?
    Abstract data type :-)

    >>If I use * for every structure passing, would it be safe?
    Sure, as long as you use the pointers properly it's perfectly safe :-)
Results 1 to 25 of 362
Page 1 of 15 1 2 3 4