Old kys edition
/dpt/ - Daily Programming Thread
>array of arrays
>ARRAY
>OF ARRAYS
>multi-dimensional array
>MULTI-DIMENSIONAL
>ARRAY
know the difference
fucking retarded C spergs
big dick playa here, careful what you say or you'll get rekt hard
STFU retarded.
Original code was in C dumbass
kys
kys
kys
there's no difference tho
tard, I already slapped your face with my big dick, when are you gonna learn?
weak as shit trolling fuck off to Sup Forums or reddit or something
lets be fucking real C# really is a comfy language whether you like it or not. Its syntax is straightforward, has many diverging functions, #diversity, and is getting more and more popular. And LINQ is based as god. The language is basically wisywig, no bullshit about it.
Why the hate fellas? Seriously...
why do you want me to leave? can't take this huge dick in your mouth anymore?
>VM language
kys
>stale pasta
Topkek, there is literally no difference.
>hurr durr
kys
[ , ] != [ ] [ ]
>[,]
get a load of this webshit
>C
>array of arrays
This is about as retarded as going into a Java thread and talking about pointers, or going into a Python thread and talking about static typing
kys
Yeah, the left one isn't even valid syntax, nice job.
>[ , ]
>shitposting about a language you don't know
kys
fucking IDIOT, in C you still have arrays of arrays, like a two star pointer with separate malloced arrays, or an array of pointers, that's not a contiguous multi-dimensional array
>This is about as retarded as going into a Java thread and talking about pointers
What Java calls references are actually pointers without arithmetic.
>or going into a Python thread and talking about static typing
Since version 3.5, Python supports static type hint annotations.
>C spergs are so stupid that even distinguishing between multi-dimensional arrays and arrays of arrays is too confusing for them
no wonder you hate OOP lmfao you're stupid as hell
Those are dynamic arrays, not regular arrays dumbass.
Be explicit otherwise you're shitposting
3/10
Still not pointer control
Still only hints, and has no effect on interpretation
>in C you still have arrays of arrays
yes
>or an array of pointers
pointers are not arrays
you can have a dynamic multi-dimensional array idiot
if it's not contiguous it's not one array, it's multiple arrays, hence array of arrays
>pointers are not arrays
they are
>Those are dynamic arrays
no
>you can have a dynamic multi-dimensional array idiot
we were talking about non-dynamic multi-dimensional arrays retard
array of pointers to arrays obviously DUMBASS
those are not arrays of arrays, dumbass
kys
Look at this faggot.
No they aren't, sweetie.
Array to pointer decay is literally C 101.
we weren't specifically talking about non-dynamic arrays only, delusional retard, and even so, it doesn't make any difference, it's retarded to say "dynamic arrays" for everything with no distinction between contiguous multi-dimensional arrays and arrays of arrays
Why are all web "developers" so shit at creating quality code?
so arrays of pointers, not arrays of arrays, fucking retard, kys
>I don't know what I'm talking about
ok
>didn't even see the original code before shitposting
kys
>still pushing this meme
kys
a c++ function that takes an int array as input and saves them in a new array.
if number is is even the number occurs twice.
if not, than not.
int * mult(int* arr,int len,int j) {
int k;
int* res = new int[len*2];
for (int j = 0,k=0; k
>Array to pointer decay
there's no such thing
>HURRRRRRRRRRRRRRR
nice moving the goalposts
the other day you were saying that your separately malloced shit was a multi-dimensional array but now it's just pointers lmfao you C tards can't even agree on your disgusting shit
kill yourself
but they are, though
This is how you declare multi-dimensional dynamically allocated arrays in C.
int **arr = (int **) malloc(sizeof(int *) * x);
int i;
for (i = 0; i < x; i++)
arr[i] = (int *) malloc(sizeof(int) * y);
arr[x][y] = 32;
Everything else is undefined behavior.
>moving
>he says, changing arrays of arrays to array of pointers
kys
>no distinction between contiguous multi-dimensional arrays and arrays of arrays
correct
That's some pretty weak b8, user.
Just denying reality isn't going to cut it.
>>didn't even see the original code before shitposting
LITERALLY KILL YOURSELF YOU INSUFFERABLE RETARD
SEE: YOU'RE SIMPLY WRONG
KILL YOURSELF RETARD
not at all, kid
and you say C isn't shit when this is the quality of the language and its users LMFAO YOU'RE A FUCKING JOKE DUDE
>fragmenting your heap
kys
>excessive caps locks
kys
that's not a multi dimensional array
weak bait
Hey guys!
My friend showed me Sup Forums a while back. I've been lurking forever until now.
I'm learning Python using codeacademy. My friend (who encouraged me to learn so he could help me with Programming projects and vice versa) is a bit busy right now and can't answer all my questions.
Language seems amazing so far, nothing is explicitly typed and it's super easy to use everything.
The only other languages I know are Basic and Java, what should I be looking to use Python for that the others are subpar at?
>inb4 Pajeet
Nope sorry, just a CompSci student
>inb4 it's not REALLY CompSci, it's just Programming
That's the term everyone else uses, I'll use it too.
Thanks in advance Sup Forums!
>its users
yes, users such as yourself are retarded, I never denied that
This.
It's a pointer to an array of pointer to arrays of ints.
kill yourself pathetic retard
how can i know the number of elements in an array if i don't know how many it will have?
like
int array[] = {1,2,3,4,5,6,7,8};
for (int i = 0; i < array_size; i++ )
printf("%d", i);
// array_size ?
>yes, I am a retard and I got rekt
I know
Mathematic/Scientific computation
Deep/Machine learning
Big data
Image manipulation algorithms
Anything really
>what should I be looking to use Python for
nothing, it's complete and utter shit
ahahah
Yes?
It's a 2D array.
Here's a 3D array!
int ***arr = (int ***) malloc(sizeof(int **) * x);
int i, j;
for (i = 0; i < x; i++)
arr[i] = (int **) malloc(sizeof(int *) * y);
for (i = 0; i < x; i++)
for (j = 0; j < y; j++)
arr[i][j] = (int *) malloc(sizeof(int) * z);
arr[x][y][z] = 32;
8
kys
What I love about Sup Forums is the quality posts and informed discussion.
t. Nobody ever.
stay delusional fucking idiot
you're the one who can't distinguish between different simple concepts and you use fucking C when you have no business using it, and you write memory-fragmented shit while delusionally thinking your performance is good lmfao kill yourself
>It's a 2D array
you are mistaken
>Here's a 3D array!
also wrong
Why user?
Everyone has a favorite language, my friend's is Python.
It feels better than Java, which I know is a huuuuuuuuuuuge meme around here.
(It's also used to run Toontown, which I want to be a dev for)
Why Image manipulation?
why are you still pretending not to be aware of the size of my dick? really, you're just embarrassing yourself, user
how many more times do you want me to rape you?
using malloc that way is not guaranteed to be contiguous.
For example, arr[i][3] (element 0) might not start immediately after arr[i][2] (element y).
An int pointer to arr[i][2][y] which is modified by the "++" postfix won't necessarily point to arr[i][3][0].
That's the difference between arrays of arrays and arrays of pointers.
>Why Image manipulation?
pillow library and the like
I don't think I stressed how new I am, I haven't used any library except math.
I'd google it, but I have a feeling you could give me a better answer
what's the int j doing in the method parameters?
quick overview: pillow.readthedocs.io
Why does it need to be continuous?
Even if they don't read continuously, it's all allocated in a continuous block of memory for the entire structure.
Also, what fucking language automatically increments the subscripts for you?
I've never seen that before.
>not contiguous
>hence array of arrays
arrays of arrays are contiguous tho
>contiguous
it's called a multi-dimensional array
>continuous
>continuously
>continuous
We're talking about arrays, they are contiguous you dumbfuck
VxWorks is pissing me off. I've got this function that gets hooked onto any syscall that gets made, using the syscallEntryHookAdd function. The syscall passes it a struct containing the arguments, the syscall number, the user stack register and frame register, the return address, and the user status register. What I don't get, is any other relevant information about the real time process that made this syscall.
Here's the problem: Kernel uses physical addressing, RTP uses virtual addressing. I can't read from the RTP's buffers to get, say, a filename, without translating the address with vmTranslate. This would be all well and good if I could get the virtual memory context from the syscall. I can't even get a task ID from the syscall information to possibly use to get a virtual memory context (although I can't find any of that information in the many layered struct that is the task control block).
And to make matters worse, all of the documentation from WindRiver is shit.
kys
yes, an array of arrays is a multidimensional array
Every row is continuous.
Every column is just a pointer to a row, how do you not understand this?
Every row is contiguous you dumbfuck, kys
Are you running on x86? If so just look at CR3 ...
>Why does it need to be continuous?
so that you can use pointer math to move around the array.
adding to a pointer should point to the next available location in the array.
so if you're at [i][j][k], incrementing (by whatever method) should be [i][j][k+1], then [i][j][k+2] and so on, until the dim edge where'd you then move to [i][j+1][0].
Because the entire array is contiguous. This wouldn't work in your case because calling malloc multiple times, even with nothing in between, is not guaranteed to return results that are contiguous in memory (more precisely, virtual address space).
You should also be able to do
pointer + (sizeof(k_dimension)) to move from [i][j][k] to [i][j+1][k], and similarly to above this wouldn't work in a non-contiguous array.
Every row is still a number of separated elements, thus they are contiguous, not continuous
Scripting languages are really good at prototyping.
A lot of people end up shipping their prototype, and then it becomes a nightmare to maintain and people just stick with making changes to the prototype instead of building the real system.
Java is good if you want to build it put it on a bunch of different systems, but you should probably learn a compiled language if you want to progress into the fast and native applications.
>nightmare to maintain
kys
you might be too young to remember, but python decided to change the entire language, so people who made something for version 2 couldn't easily be ported to version 3.
It took a long time for the ones who did, but a lot of projects haven't gotten around to that yet.
>couldn't easily be ported
>what is 2to3
fuck off
My job is working with large python projects, about 120 of them. Hard to maintain is a meme, kys
can you please, please, suck my dick?
why is everyone so hostile here?
>stop raping me
:^)
>My job is working with large python projects, about 120 of them.
interesting.
do you use any IDE or text editor? what about version-control?
because they're retarded mouthbreathers that get defensive when the big dick playa shows them their place
People here are super insecure and need to shout the loudest that they're the best.