User Profile

Collapse

Profile Sidebar

Collapse
livesinabox
livesinabox
Last Activity: May 31 '10, 06:54 AM
Joined: May 28 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • livesinabox
    replied to File Handling in C
    in C
    Thank you for you're help!
    And yes I was warned against using the gets function.. I changed it to scanf! Thank you!
    See more | Go to post

    Leave a comment:


  • livesinabox
    started a topic File Handling in C
    in C

    File Handling in C

    Code:
    #include<stdio.h>
    #include<string.h>
    main()
    {
    FILE *f1,*f2;
    char str[10];
    f1=fopen("file1.dat","w");
    printf("Enter contents of file 1 :");
    gets(str);
    fputs(str,f1);
    fclose(f1);
    f1=fopen("file1.dat","r");
    f2=fopen("file2.dat","w");
    fputs(str,f2);
    
    fclose(f1);
    ...
    See more | Go to post

  • livesinabox
    replied to Trouble understanding "Double" Pointers.
    in C
    That helps! Thank You!
    See more | Go to post

    Leave a comment:


  • livesinabox
    started a topic Trouble understanding "Double" Pointers.
    in C

    Trouble understanding "Double" Pointers.

    I am a student and I am having trouble understanding Dynamic Memory Allocation and the usage of Double Pointers.

    Code:
    int **A
    
    A=(int **)malloc(r1*(sizeof(int*)));
    
    for(i=0;i<r1;i++)
    A[i]=(int *)malloc(sizeof(int)*c1)
    In the above snippet r1 and c1 refer to the number of rows and columns of a matrix A.

    My question : What does the malloc function do here? I know malloc()...
    See more | Go to post
    Last edited by Banfa; May 28 '10, 09:20 AM. Reason: Use this slash / for closing tags :-)
No activity results to display
Show More
Working...