Search:

Type: Posts; User: unikgila

Search: Search took 0.00 seconds.

  1. Replies
    2
    Views
    10,497

    memory allocation for strcpy

    Hi all,

    Suppose i have a char variable pointer, and i allocated memory using malloc. is it different between using strcpy and assigned value directly to this pointer?


    char *s1;
    s1 = (char...
  2. Replies
    10
    Views
    2,228

    I mean Malloc doesn't initialize memory to zero,...

    I mean Malloc doesn't initialize memory to zero, but assigned the value to 0.


    int main()
    {
    int x = ARRAY_SIZE;
    int *pa, *pb, *pc, *pd;
    pa = malloc(sizeof(int) * x);
    pb =...
  3. Replies
    10
    Views
    2,228

    In this case i know how many values, but suppose...

    In this case i know how many values, but suppose i don't know how many values that i have assigned. is there any way to know it?

    Because, in my understanding, if i already reserve the memory using...
  4. Replies
    10
    Views
    2,228

    How do i know the size of variable pointer

    Hi all,

    I have a variable pointer, which i allocate the memory using the malloc command. I want to reverse the order of the variable pointer. But how do i know the last memory address for this?
    ...
  5. Replies
    11
    Views
    46,923

    Yes, there are a lot warning when compilation. I...

    Yes, there are a lot warning when compilation. I ask this because when i compare it with string that you have mentioned it.

    Usually i can use
    char *x = "hello";
    printf("%s \n",x) ==> hello...
  6. Replies
    11
    Views
    46,923

    still error ==> segmentation fault ok, i show...

    still error ==> segmentation fault

    ok, i show the code:


    int main()
    {
    int *pa = {1,2,3,4,5,6}
    for(j=0; j<5;j++)
    {
  7. Replies
    11
    Views
    46,923

    I follow your code, but i just got 0x1 I...

    I follow your code, but i just got
    0x1

    I want to the whole array in variable can be printed, so the expectation result is
    1 2 3 4 5 6
  8. Replies
    11
    Views
    46,923

    how to print pointer variable

    Hi all,

    Need explanation how can i print this :


    int *pa = {1,2,3,4,5,6};


    if i use
    printf("%d",pa) ===> result is 1
  9. Replies
    16
    Views
    4,721

    thanks for both of you :)

    thanks for both of you :)
  10. Replies
    16
    Views
    4,721

    Sorry for not understand what you explain :( . If...

    Sorry for not understand what you explain :( . If possible, i hope you can give me the sample code or repair the code that i have wrote above. Thanks
  11. Replies
    16
    Views
    4,721

    You are right, however if i still define struct...

    You are right, however if i still define
    struct a[10];
    sizeof(a) == 360

    I think my first question still was not answered, because the memory already prepare for 10 variables a
  12. Replies
    16
    Views
    4,721

    Hi Nonoob, You mean, i don't need to define...

    Hi Nonoob,

    You mean, i don't need to define variable a[10] instead of just put *a ?
    I follow your idea, but i got the 0 result for sumStructs function. I modify my code like this:


    ...
  13. Replies
    16
    Views
    4,721

    how to know dynamic size of struct

    Dear all,

    Suppose i have a program that is consisted of a struct. this struct will be used as an array.


    typedef struct
    {
    char name[30];
    int salary;
    } person;
  14. Replies
    8
    Views
    1,114

    Thanks tabstop, I add second parameter for...

    Thanks tabstop,

    I add second parameter for the number of array in b. it solve the problem. And again thank you for your explanation
  15. Replies
    8
    Views
    1,114

    Hi tabstop, I still curious about his, i think...

    Hi tabstop,

    I still curious about his, i think when the p point to out of array of b, i this case because i have put
    b[] = {2,3,4,2,3,6}, the maximum array that can be pointed by p is b[5], and...
  16. Replies
    8
    Views
    1,114

    I don't know either, but in my understanding the...

    I don't know either, but in my understanding the last array should be the value '\0'. Anyway could you show me the running example for this problem ?
  17. Replies
    8
    Views
    1,114

    No i want to the *p point to b[0] and then b[1]...

    No i want to the *p point to b[0] and then b[1] continue to b[5], i add some printf to show the exactly what the problem


    #include <stdio.h>

    main(void)
    {
    int b[] = {2,3,4,2,3,6};
    int i;...
  18. Replies
    8
    Views
    1,114

    problem with pointer

    Hi all,

    I have short program with pointer


    #include <stdio.h>

    main(void)
    {
    int b[] = {2,2,2,2,2,2};
Results 1 to 18 of 18