Search:

Type: Posts; User: wonderwall

Search: Search took 0.01 seconds.

  1. Thanks! I finally got it!

    Thanks! I finally got it!
  2. Yup there is pattern to it. Eh it works now. but...

    Yup there is pattern to it. Eh it works now. but i dont really understand the way you do it. why & is required in this case? I didnt use atoi before. I thought its just convert string to integer, why...
  3. How to sort string with both alpha and number?

    I store a string of both letters and numbers in the array.
    Eg. ABC123, XYZ456.
    However i want to sort by the numerical part only.
    How can i do that? I try using isdigit() but i doesn't work.


    ...
  4. Replies
    2
    Views
    1,272

    Why i can print string beyond the range?

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


    void main()
    {
    char arr[7];
    scanf("%s", arr);
    printf("String:%s",arr);
    }
  5. Replies
    3
    Views
    2,774

    Ok thanks! If i dont want to print with a...

    Ok thanks! If i dont want to print with a newline, i can just use printf("%s", str); right?
    And it is necessary to have this step after fgets


    fgets(str, LENGTH, stdin);
    str[strlen(str) -1] =...
  6. Replies
    3
    Views
    2,774

    Use of puts(str) vs printf("%s", str);

    Both puts(str) and printf serves the same purpose. Why puts(str) is usually preferred in string than printf?

    Thanks!
  7. Replies
    5
    Views
    5,235

    fgets vs gets

    Hi i am new to the topic about strings. Can i know what is the differences between fgets or gets? i cant seem to get the same output.



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


    int...
  8. Replies
    3
    Views
    3,049

    Its for my own self practice that I found it from...

    Its for my own self practice that I found it from the Internet Recursion!HAHA
  9. Replies
    3
    Views
    3,049

    Integer partition

    Q.A partition of a positive integer n is a sequence of positive integers that sum to n. Write a program to print all non-increasing partitions of n.

    eg. n=4
    4
    3 1
    2 2
    2 1 1
    1 1 1 1
  10. Replies
    5
    Views
    22,276

    int getMax(int arr[], int size, int max, int i){...

    int getMax(int arr[], int size, int max, int i){
    if(i<size)
    {
    if(max<arr[i])
    max= arr[i];
    getMax(arr, size, max , i+1);
    }

    return max;
    }
  11. Replies
    5
    Views
    22,276

    i tried but it doesnt work still.

    i tried but it doesnt work still.
  12. Replies
    5
    Views
    22,276

    finding max in array using RECURSION

    #include <stdio.h>


    int getMax(int [], int, int, int);
    int main(void)
    {
    int arr[10]={0}, i;
    printf("Enter the 10 elements: ");
    for(i=0; i<10; i++)
    {
  13. Replies
    9
    Views
    1,822

    Recursion question to practise

    Hi is there any books or websites that I can refer to for more practice on recursion for c programming? Seems like those I find is the standard gcd, tower of hanoi and etc. Want to get more...
  14. Finding maximum and minimum number in 2D array

    void findMaxnMin(double x[][COLS])
    {
    int max=x[0][0], min= x[0][0];
    int i,j;

    for (i=0; i<ROWS; i++)
    for (j=0; j<COLS; j++)
    {
    if(x[i][j]> max)
    max= x[i][j];
  15. Replies
    4
    Views
    9,792

    Oh it is because if i swap till length, not...

    Oh it is because if i swap till length, not length/2, array will still be 1,2,3,4,5?

    In what kind of circumstances, should i use length instead of length/2?
    what about the first code? i didnt use...
  16. Replies
    4
    Views
    9,792

    Reverse an array

    Hi i have 2 function for reversing arrays. One work and the other doesn't. can help me analyse why the first is wrong?


    void reverse_array(int arr[], int length)
    {
    int i,j;
    ...
  17. Replies
    3
    Views
    1,390

    Thanks Quzah! i think i just created a infinite...

    Thanks Quzah! i think i just created a infinite loop!


    #include<stdio.h>
    int getBinomial(int, int);


    int main(void)
    {
    int n,k;
  18. Replies
    3
    Views
    1,390

    recursion to find binomial

    11011hi can someone help me check if my recursion is right? i cant seems to get the answer:(


    #include<stdio.h>
    int getBinomial(int, int);


    int main(void)
    {
    int n,k;
Results 1 to 18 of 18