Anonymous
How to do admin
No one is going to do your homework completely, read the rules This chat is for people that have already done something and faced difficulties
Aira
Yaa..i know just give me hint
Anonymous
Yaa..i know just give me hint
#include <stdio.h> Now your hints are exhausted
Aira
Ok
Aira
Thanks
Anonymous
using namespace std;
The person wanted to use C
Dima
The person wanted to use C
It was sarcasm-ish joke
Anonymous
It was sarcasm-ish joke
I'm bad at it
András
If I compile program in normal way, will maximum heap size be limited by RAM?
Anonymous
If I compile program in normal way, will maximum heap size be limited by RAM?
It depends on OS, compiler and compiler options, I think Mostly on OS and how it manages the RAM
Anonymous
If I compile program in normal way, will maximum heap size be limited by RAM?
Why are you asking? Just curiosity or you faced a problem?
András
Why are you asking? Just curiosity or you faced a problem?
Just decided to write own malloc/realloc/free
Anonymous
Just decided to write own malloc/realloc/free
I think googling jemalloc can help you. It's open-sourced memory allocator by Google
Anonymous
Just decided to write own malloc/realloc/free
I hope you decided to do it just for learning
Artöm
C programming for even numbers upto 100 which r multiples of 7
for (int num = 14; num < 100; num += 14) { /* output */ }
Anonymous
Can be another reasons?
Some people don't like using libraries and write their own, because they think that they can do it better In most cases they can't
András
I don't think so
They can, but in most cases they failed this task
I_Interface
Bro
Flooding for Bro ? :D
Al
hello one question , if i have a pointer to an array given in input to a function ... lets say: void (int *) ; is it possibile to determine the size of the array insiede the function , or i need the pass the value to the function as input?
Al
sorry i miss the name of the funciont : lets say: void myFunc ( int *)
Al
no that point to the starting point of an array
Anonymous
With bare pointer you can't determine the size of an array
Al
ill pass to the function the starting point of the array
Al
yes i suspected that
Al
thanks a lot guys
Al
ill work with array then
Anonymous
no that point to the starting point of an array
It is still is not a pointer to an array. A pointer to array looks kinda like this: int (*)[10]
Al
or i will pass the size in a separate value
MᏫᎻᎯᎷᎷᎬᎠ
No, you can't
The bare pointer passed to the function Don't have any related meta-data that determine the size
Al
no ill pass the starting value of the array
MᏫᎻᎯᎷᎷᎬᎠ
Unless you use std::array
Al
then i can p++ to scan the array
MᏫᎻᎯᎷᎷᎬᎠ
Or using templates
MᏫᎻᎯᎷᎷᎬᎠ
Al
is C no C++
Al
Ops
thanks anyway
MᏫᎻᎯᎷᎷᎬᎠ
There's no such way But you can pass size argument to the function
Anonymous
Or you can define a struct
MᏫᎻᎯᎷᎷᎬᎠ
I think that how functions in C deal with collection of data
Al
Or you can define a struct
yes thata snoter solution but in this specific case im kinda obliged to use an array
MᏫᎻᎯᎷᎷᎬᎠ
Or you can define a struct
That keeps track of the array size, nah I think not
Al
sorry for typos...
MᏫᎻᎯᎷᎷᎬᎠ
yes thata snoter solution but in this specific case im kinda obliged to use an array
Then there is no way, except to pass the array with size variable
Al
That keeps track of the array size, nah I think not
no i think he was suggesting to NOT use the array but to change it into a struct
Al
thank for helping !
MᏫᎻᎯᎷᎷᎬᎠ
sorry, we aren't in c++
That's literally what I'm talking about It's annoying to do this Array ar; ar.elems[0] = 1; ar.size = 1
Anonymous
That's what I was talking about
MᏫᎻᎯᎷᎷᎬᎠ
ar.elems[1] = 7; ar.size = 2; Looool
Anonymous
ar.elems[1] = 7; ar.size = 2; Looool
You can write function to manage this stuff
Anonymous
But again I was talking about other usage
MᏫᎻᎯᎷᎷᎬᎠ
You can write function to manage this stuff
?? You can't write methods in C
Anonymous
?? You can't write methods in C
What's wrong with simple functions in this case?
C.
?? You can't write methods in C
You kinda can. There are some crazy people that make C Obj oriented with structs and such
Anonymous
C.
Yes I've heard about it But it is so weird and ugly
It uses undefined structs. It's strange,
Daniele°
Or GTK
Anonymous
pointers urggghh
Anonymous
i asked someone before if there was an way to find the length of a string in C
Anonymous
i was given a for loop , lol
Anonymous
strlen
yea i know now , i am on the third section of my studies
I_Interface
i asked someone before if there was an way to find the length of a string in C
int strLength(const char* str) { int it = 0; while(str[it] != '\0'){ ++it; } return it; }
Anonymous
int strLength(const char* str) { int it = 0; while(str[it] != '\0'){ ++it; } return it; }
makes sense , if its not the null character( the end of the string) keep on counting up lol