Search:

Type: Posts; User: Peachy

Search: Search took 0.01 seconds.

  1. Replies
    10
    Views
    4,302

    this code is giving a compilation error; I don't...

    this code is giving a compilation error; I don't know what to change on the red highlighted line.






    #include <stdio.h>

    char * catstr(char * s1, const char * s2);
  2. Replies
    4
    Views
    1,195

    Basically the code prints out the binary...

    Basically the code prints out the binary equivalent to the number input by user. But I am failing to see how it prints a 1, exactly. I think when with the expression

    putchar('0' + n%2);

    the...
  3. Replies
    2
    Views
    3,040

    function definition with structure node

    I need to write a definition of a function with all the following points to be addressed:



    function name is Problem
    it receives a parameter named b of the struct node * type
    it creates...
  4. Replies
    7
    Views
    3,131

    I fixed the scanf call. I use input of (7,3)...

    I fixed the scanf call.

    I use input of (7,3)
    7th row of pascal's triangle, 3rd element
    result should be 35 (i thought this was the 4th element, myself)

    getting garbage output, why???
  5. Replies
    7
    Views
    3,131

    Code compiles okay. But when I run program after...

    Code compiles okay.
    But when I run program after I enter my values as asked,
    get segFault. Why ???

    I think my scanf and printf lines in main() might be the problem.
    Please help.

    I want...
  6. Replies
    7
    Views
    3,131

    I have three questions: 1) what is the best...

    I have three questions:

    1) what is the best method of asking for user input of n and k values ? such as in the form C(1,2)

    2) shouldn't the below code have an additional set of parentheses...
  7. Replies
    7
    Views
    3,131

    recursion function / Pascal

    I need to write a RECURSIVE function to calculate binomial coefficients.

    It has been 9 years since last I took a mathematics course.
    I have forgotten the purpose of this formula:

    C(n,0) = 1...
  8. Replies
    1
    Views
    1,719

    Conditional Compilation

    I am not understanding the following textbook question:

    Suppose the following macro M is defined as such:

    #define M 10

    Which of the following tests will fail??

    (a) #if M
    (b) #ifdef M
  9. Replies
    5
    Views
    1,437

    ok so, say str[10] = "balance"; &str[1] will...

    ok so, say str[10] = "balance";

    &str[1] will look at this as " alance "
    not as " a " (the first 'a' in the string) ??

    and str+1 will do the same as &str[1] ???
  10. Replies
    5
    Views
    1,437

    PINKO: how is the string being access if there...

    PINKO:

    how is the string being access if there is no incrementation of
    str ?? how is str[2] , str[3] being checked against ch??? I don't see where there is incrementation to next element of...
  11. Replies
    5
    Views
    1,437

    recursive function

    I am trying to follow the logic of the following program:

    Is the mystery function in effect counting the # of instances a character variable shows up in a string? Please explain the code in the...
  12. Replies
    5
    Views
    4,880

    ok fixed the prototype problems now I just...

    ok fixed the prototype problems

    now I just need a little guidance in the loop needed to sort the strings input (words) into smallest to largest lengths. How do I do that?

    What is the best...
  13. Replies
    5
    Views
    4,880

    Getting past the strlen issue ..........

    Can someone reply with an answer to my original problem???

    I need to understand the order of the function calls AND the loop involved to find the smallest to largest length string.

    Got any...
  14. Replies
    5
    Views
    4,880

    why did you declare and define strlen() in your...

    why did you declare and define strlen() in your program

    -----------------------

    I suppose cause I didn't understand why my book had the function written out longhand, and didn't know what the...
  15. Replies
    5
    Views
    4,880

    length of string etc.

    program must let user input words
    stops when length of word is 4 characters
    keeps track of length of all words, prints out shortest and longest words
    (part of the instructions say that the...
  16. Thread: strcat function

    by Peachy
    Replies
    1
    Views
    1,459

    strcat function

    what is the following code doing, particularly in the *strcat1 function???
    (1)explain to me the reason for two while loops,
    (2)why does the first have just *p2 : no assignments or logical...
  17. Thread: strcpy command

    by Peachy
    Replies
    10
    Views
    3,729

    And so I check for NULL by also checking for 0...

    And so I check for NULL by
    also checking for 0




    char *strcpy (char *End, char *Begin)
    {
    char *s, *t;
  18. Thread: strcpy command

    by Peachy
    Replies
    10
    Views
    3,729

    Explain diff between 'empty' and 'NULL'

    Please I don't see the difference between an empty string
    and NULL.
  19. Thread: strcpy command

    by Peachy
    Replies
    10
    Views
    3,729

    so no-one's code is complete??? the code...

    so no-one's code is complete???

    the code states that while *s is not pointing to the NULL
    *s increments to next char in string and copies to t ??
    when *s finally gets to the NULL loop stops...
  20. Thread: strcpy command

    by Peachy
    Replies
    10
    Views
    3,729

    strcpy command

    please explain strcpy command !!!!!!!!

    is the following a valid function ??




    char *strcpy (char *End, char *Begin)

    { char *s, *t;
  21. Replies
    5
    Views
    923

    What I really wanted to know

    Stoned Coder ---------

    Thanks for the step by step, however,

    The original question was:

    what will be the contents of the array SORT after the following statements are done??

    And my...
  22. Replies
    5
    Views
    923

    ARE you kidding or being facetious???

    I am just trying to understand the question??
    pointers are a bugger to get and C depends on knowing
    arrays and pointers.
  23. Replies
    5
    Views
    923

    arrays and pointers

    what will be the contents of the array SORT after the following statements are done??



    #define ELEMENTS 7

    int SORT[ELEMENTS] = {2,4,6,8,10,12,14};
    int *s = &SORT[0], *t = &SORT[ELEMENTS...
Results 1 to 23 of 23