User Profile

Collapse

Profile Sidebar

Collapse
dperren
dperren
Last Activity: Apr 11 '08, 02:24 PM
Joined: Mar 22 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • dperren
    replied to Copy dynamically allocated array of ints
    in C
    Ahh, brilliant!

    Combination of memcpy and remembering the amount of memory initially allocated did the trick.

    Thanks everyone!
    See more | Go to post

    Leave a comment:


  • dperren
    started a topic Copy dynamically allocated array of ints
    in C

    Copy dynamically allocated array of ints

    Example code:

    Code:
    		int a, b, c;
    
    		int *t1;
    		int *t2;
    		t1 = malloc(3*sizeof(int));
    		t1[0] = 1;
    		t1[1] = 2;
    		t1[2] = 3;
    		t2 = malloc(3*sizeof(int));
    		t2 = t1;
    		
    		a = t2[0];
    		b = t2[1];
    		c = t2[2];
    
    		t2[0] = 5;
    This appears to work fine (copying t1 into t2), until modifying t2, when t1 is modified as well...
    See more | Go to post

  • That seems to have done the trick.

    Thanks for the solution :)
    See more | Go to post

    Leave a comment:


  • That doesn't seem to be working unfortumately:

    The code I have:
    Code:
    #include <stdio.h>
    
    int main(void)
    {
    	char n[] = "731671765313306249192251196744265747"; //This keeps going for longer in the actual version
    	int v = n[0];
    	
    	printf("%d \n", v);
    }
    This outputs '55'. Changing 'int v = n[0];' to 'int v = n[0]+'0'; outputs 103. Possibly...
    See more | Go to post

    Leave a comment:


  • dperren
    replied to Syntax error
    in C
    No worries, I just spend 10 minutes wondering why:

    void void(main){
    }

    wouldn't compile!
    See more | Go to post

    Leave a comment:


  • dperren
    replied to Syntax error
    in C
    void ini_colmatdin (int *)

    You're missing a semicolon.
    See more | Go to post

    Leave a comment:


  • C - integer from string in array of chars (or array of integers?)

    Hi.

    I've just thrown myself head first into C, and am having a bit of trouble getting my head round the way the datatypes and arrays work.

    At the moment, I'm working on a problem which involves a very long (1000 digit) number - I need to pick out individual digits from it, rather than use it as a whole. The idea I initially had was to do:

    char n[] = "12325346547346 34...";
    int v = n[0];...
    See more | Go to post

  • dperren
    replied to C# ASP.net ImageButton click event problems
    in .NET
    Managed to sort it - the IsPostBack indeed shouldn't have been there; instead I cleared the tables of their rows and updated them with the new ones.
    See more | Go to post

    Leave a comment:


  • dperren
    replied to C# ASP.net ImageButton click event problems
    in .NET
    Please excuse the double post, but I created a very simplified version of the application which has exactly the same effect:

    Code:
    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    
    public
    ...
    See more | Go to post

    Leave a comment:


  • dperren
    started a topic C# ASP.net ImageButton click event problems
    in .NET

    C# ASP.net ImageButton click event problems

    At current, I have a set of dynamically generated image buttons, which are created with this (excert) of code:

    Code:
    TableCell tasks = new TableCell();
    
    while (reader.Read())
                    {
                        ImageButton button = new ImageButton();
    		    button.Click += new System.Web.UI.ImageClickEventHandler(taskButton_Click);
                        button.ImageUrl = "Images/task.gif";
    ...
    See more | Go to post
No activity results to display
Show More
Working...