Search:

Type: Posts; User: gunitinug

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    6
    Views
    1,944

    Thx for the clarification. The following works...

    Thx for the clarification. The following works now



    #include <stdio.h>

    int main(void)
    {
    // you need malloc otherwise memory error.
    char* string=(char*)malloc(5);
  2. Replies
    6
    Views
    1,944

    This works. #include int...

    This works.



    #include <stdio.h>

    int main(void)
    {
    // you need malloc otherwise memory error.
    char* string=(char*)malloc(5);
  3. Replies
    6
    Views
    1,944

    Char pointer passed to function

    #include <stdio.h>

    int main(void)
    {
    // you need malloc otherwise memory error.
    char* string=(char*)malloc(5);
    set(string);
    printf("%s",string);
    return 0;
    }
  4. Thread: 2d array

    by gunitinug
    Replies
    3
    Views
    1,074

    2d array

    #include <iostream>
    using namespace std;

    int HighestTemp(int**, const int, const int);

    int HighestTemp(int** temp, const int row, const int col) {
    int highest = 0;
    for (int i=0; i<row;...
  5. Replies
    2
    Views
    711

    THank you

    THank you
  6. Replies
    2
    Views
    711

    array not displaying values

    #include <iostream>
    using namespace std;

    const int MAX=100;
    int elems[MAX]={1,2,3};
    int card=3;

    void Rem(const int e);

    void Rem(const int e) {
  7. THX elysia

    THX elysia
  8. function that returns a constant reference

    std::string const & user::nickname() const
    {
    return m_data->nickname;
    }


    Here what is the meaning of & used? THanks.
  9. Thanks man. Don't call me wacko though. I was...

    Thanks man. Don't call me wacko though. I was trying to create a tree like structure.

    Fixing that small error it prints 123.



    /*
    * treeattempt1.h
    *
    * Created on: 21/06/2012
  10. retrieving a value from nested struct gives negative values

    /*
    * treeattempt1.c
    *
    * Created on: 21/06/2012
    * Author: logan
    */

    #include <stdio.h>

    struct node {
  11. Replies
    5
    Views
    1,583

    I did coding on galaxy tab. woot

    I did coding on galaxy tab. woot
  12. Replies
    5
    Views
    1,583

    Ok i'll look into it :o

    Ok i'll look into it :o
  13. Replies
    5
    Views
    1,583

    Autocomplete feature prototype

    Say you are in chat room and in it there are 3 users.
    paul127, mary532, mark456
    You type pau and press tab to automatically complete paul's user name. The following code prototypes that feature.
    ...
  14. Thread: Sig fault

    by gunitinug
    Replies
    2
    Views
    827

    Thanks. I had to reset i and j to their original...

    Thanks. I had to reset i and j to their original values inside while loop. Here's code returning "app" as expected after matching.



    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>...
  15. Thread: Sig fault

    by gunitinug
    Replies
    2
    Views
    827

    Sig fault

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

    const char* search1="";
    const char* search2="apple";
    const char* search3="apple tree";

    char* strings1[3]={"","",""};
    char*...
  16. Replies
    4
    Views
    788

    Thanks tc. I've tried your code. #include...

    Thanks tc. I've tried your code.



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

    int main() {
    char buf[3][10]={"pine", "apple"};
  17. Replies
    4
    Views
    788

    Seg fault on pointer of pointer

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

    int main() {
    char buf[3][10]={"apple", "pineapple", "banana"};
    char** ptr=(char**)buf;
    puts(*ptr);
    }
  18. ok thanks ;)

    ok thanks ;)
  19. Output gives blank line instead of "hello".

    Output gives blank line instead of "hello".
  20. warning: function returns addresss of local variable

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

    char* test(char* s) {
    char ret[]="";
    strcpy(ret, s);
    return ret;
    }

    int main() {
  21. Replies
    5
    Views
    1,301

    free(ptr[1]); This gives me either memory...

    free(ptr[1]);


    This gives me either memory dump or seg fault. How to free ptr, ptr[0] and ptr[1] safely?

    OK memory leaked so it can't free it.

    This works.
  22. Replies
    5
    Views
    1,301

    #include #include #include...

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

    int main() {
    char string[]="apple";
    char** ptr=(char**)malloc(2*sizeof(char*));
    ptr[1]=(char*)malloc(10*sizeof(char));
    ...
  23. Replies
    5
    Views
    1,301

    malloc seg fault error

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

    int main() {
    char** ptr=(char**)malloc(2*sizeof(char*));
    ptr[0]=(char*)malloc(10*sizeof(char));
    ...
  24. Replies
    3
    Views
    1,874

    oh yeah i forgot to put malloc in line 26

    oh yeah i forgot to put malloc in line 26
  25. Replies
    3
    Views
    1,874

    seg fault in pointer struct

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

    typedef struct {
    int value;
    char* value2;
    } demo;

    void test(int* v) {
Results 1 to 25 of 27
Page 1 of 2 1 2