Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C pointer

Name: Anonymous 2012-09-18 17:01

Let's say i've allocated memory for a dxd-matrix (displayed as a d^2 vector) like this:

double* A  = calloc(d*d, sizeof(double));

Now i want to set the whole vector at one, like

" &A  = {0,1,2,3}; "

But isn't working, is there a method setting the whole vector at once without going through every entry A[i] i=0,...,3?

Thank you!

Name: Anonymous 2012-09-18 17:03

lel no.

Name: Anonymous 2012-09-18 17:12

memcpy

Name: Anonymous 2012-09-18 18:47

>>1
*(struct t { double d[4]; }*)A = (struct t){ 0, 1, 2, 3 };

Name: Anonymous 2012-09-18 18:58

/polecat kebabs/

Name: Anonymous 2012-09-19 2:52

rep movsb

Name: Anonymous 2012-09-19 4:41

>>4
That is awful.

Name: Anonymous 2012-09-19 10:19

>>1
Use a language with first-class arrays.
(HEAP[d,d]REAL a; # Allocate an array on the heap #
a[1,] := (0, 1, 2, 3); # Set first row #
a[,1] := (0, 1, 2, 3); # Set first column #
a) # Result is the array #

Name: Anonymous 2012-09-19 23:52

>>7
Unnecessary, too.  What happens if the stride of the matrix isn't 4.

Name: Anonymous 2012-09-20 0:56

Damn you are so retarded.

Name: Anonymous 2012-09-20 8:07

>>10
Shalom!

Name: Anonymous 2013-08-31 17:53


Pure muscle memory for me. Some of the harder songs I might fail a bunch, but I catch on if I keep it up.
Rin-chan Now! is a good example of a song that I got stuck on for a long time before I was able to do it.

Name: Anonymous 2013-08-31 19:24





    I'm laughing too hard to be upset that it's gone.

Name: Anonymous 2013-09-01 19:56



         /::::::::::::::::::::::::::::::_>
       /::::::::::::::::::::::::::::::::::::ヽ
    「 ̄`ヽ;::::::::::::,.::--‐─ァヘヽ.
__,. -く7  =-」ゝ-く-=ニ  /-、::::::ヽ、
:::::_,.へ、____r、_____,.へ___  !、 `ヽ、_::ヽ.
>r、____rヽ、____,.ヘ____ヽ`ヽ_!__ヽ、___<::ヽ、
ハ/   !__,!ィハ ! ハ `ヽハ、___ヽ___:::::::::::::>
ヽ.レ、  i rt、/ レ' 、,!_ハ   ヽ. `ヽ_二フ
  ノ) ハ ヒ_!   ,r'-=!、! ハ  ハ!   i 
  ヽハY!" ,    ヒ__rハ (ソ)/  i / 〉    
  ノ .人    _    "(ノン    ハ  (
  〈へr V>、.,____  ,.ィ(Yノヘ  / ! ハ〉
       ,.イ/ヽ/ヽ}><{ /V  レ' 
      /7::! ! /-イ::ム ヽ.
     r〈/::::'ー':::::::::!   _r〉
     7/:::::::::::::::::::::ヘr'"´ ヘ 

Don't change these.
Name: Email:
Entire Thread Thread List