Ariana
what is there to insert
BinaryByter
data
BinaryByter
duhh
BinaryByter
xDD
Ariana
like
Ariana
oh like
Ariana
1,2,3
to
1,2,4,3
Ariana
?
klimi
hi
Ariana
Hi
Anonymous
Hi
Ariana plss can u pc? I need some help
Ariana
just send here...
klimi
i h problem with mass storage u nit T.T
klimi
[ +0.000005] sd 6:0:0:0: [sdc] Add. Sense: Medium format corrupted
[ +0.000009] sd 6:0:0:0: [sdc] 0 512-byte logical blocks: (0 B/0 B)
[ +0.000004] sd 6:0:0:0: [sdc] 0-byte physical blocks
[ +0.002938] sd 6:0:0:0: [sdc] Test WP failed, assume Write Enabled
[ +0.003060] sd 6:0:0:0: [sdc] Asking for cache data failed
[ +0.000006] sd 6:0:0:0: [sdc] Assuming drive cache: write through
BinaryByter
Ariana
prob private chat
BinaryByter
wow
Kotak
alright i try to explain in simple like if we need to insert data in 1d array we first increment the size of array then store the recent data on its next position and then the store the value at desired location alright then how can we do that operation in pointer-array
Ariana
increment size of array?
Ariana
thats a thing?
BinaryByter
why not?
Ariana
Don’t you have to realloc
BinaryByter
yes
Ariana
or else some weird heap stuff get overwritten
BinaryByter
an array is just a bunch of memory that is next to eachother
Ariana
Yes
BinaryByter
yes
Kotak
ya bt i am new to malloc ,calloc and realloc
Anonymous
BinaryByter
BinaryByter
😳😳
what did you think that an array is?
Ariana
realloc is basically freeing and re-allocating the array with a new size
basically a free and malloc combined
BinaryByter
Ariana
but its effectively the same
BinaryByter
google's got your back
Ariana
look up realloc examples
Ariana
it’s basically same as malloc
Kotak
BinaryByter
BinaryByter
xD
Ariana
Its true
BinaryByter
one is relatively easy to implement
BinaryByter
the other is not xD
Ariana
Omt lets not talk about implementing realloc
Ariana
just shut up and let dl do it
BinaryByter
okay :)
Kotak
ok will try it and say
klimi
welcome
Prabhas
Do anyone have study material for object oriented computer programming
BinaryByter
you were told to read the rules
V
hiii
klimi
Anonymous
Hi
Dima
/warn no
Dima
sorry but such stuff is not allowed, who knows maybe you are a scammer
MᏫᎻᎯᎷᎷᎬᎠ
What did he do?
Luis José
[Plain C] I'm storing some data on (characters) for analyze it on my code. Actually i'm using this struct idea:
struct data {
char sample[];
int size;
} channel1;
i want to make an efficient variable lenght arry definition, but i know it's a problem not to define the lenght BEFORE modifyng. So if I use that struct and then:
for( w=0;w<N;w++)
{
delay_ms(20);
potval = read_adc();
channel1.sample[w] = potval >> 2;
delay_ms(200);
}
The problem is that using another for structure like this one doesn't print all N values stored. but if i do the struct seems this way:
struct data {
char sample[10];
int size;
} channel1;
Works fine, but what i mean it's the lenght should be a user input. So, do you guys have a good idea about how to solve this ?
klimi
hi
Victor
if (year % 4 == 0)return true;
No. Your formula is the Julian calendar (a leap year every four years), which was used long long ago in the past. The calendar that we are using now, is the Gregorian calendar, where century years are not leap years except every 400 years.
Victor
Actually, if you really need to determine whether a year is a leap year in real world in history rather than the theoretical rule what we are using now, you might need to separate the year 1582.
Victor
Before 1582, people used the Julian calendar, and after 1582, people use the Gregorian calendar.
Victor
This is the real world
bool is_leap_year(int n)
{
if (n < 1582)
{
// Julian calendar:
// a leap year every four years
if (n % 4 == 0)
return true;
else
return false;
}
else
{
// Gregorian calendar:
// a leap year every four years,
// but except century years,
// but including every 400 years
if (n % 400 == 0)
return true;
if (n % 100 == 0)
return false;
if (n % 4 == 0)
return true;
return false;
}
}
Dima
shorter:
bool IsLeapYear(int32 year)
{
if ((year % 4) == 0)
{
return ((year % 100 != 0) || (year % 400 == 0));
}
return false;
}
Dima
who needs 1582 year in their code?
Dima
maybe time machine developers
Victor
In 1582, the calendar rule changed. That is the reason why it is coded like this.
Dima
yeah I read
Victor
The day after 4 October 1582 was 15 October 1582 😀
Anonymous
Hey @ROSE i'm new to C language, hence needed help from the pro ones , hence i joined the group . Can you guys help me with it, or is this group only for pro ones
Ariana
Is it actually possible?
Victor
Ariana
Ariana
I think ‘pro ones’ refer to people who can read
Ariana
can’t we have better non-arbitrary rules
Ariana
A sidereal year is about
365+1/(4-1/(10+13-(...
gives much better approximations
Ariana
ohgosh