[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Help me /g/, what am I doing wrong here? (C) This is literally

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 20
Thread images: 2

File: Képkivágás.jpg (69KB, 1041x492px) Image search: [Google]
Képkivágás.jpg
69KB, 1041x492px
Help me /g/, what am I doing wrong here? (C)

This is literally my code and the output is literally what happens. This shouldn't be happening, I am in charge here!
>>
>>58285346
double a[2];
double b[2];


a[n] allocates an array of size n so the max index is n - 1

what you're seeing here is an issue undefined behavior
>>
>>58285380

Yes, I am LITERALLY using (n-1), so 1 as max index. I never use a[2] or b[2] on the picture.
>>
>>58285346
what do you think should happen? seems fine to me
>>
>>58285401
n-1 is 0 fucktard, not 1
>>
>>58285415

lol it works now thx
>>
>>58285401
if you have an array of size n (double a[n]) you can index it from 0 to n-1 (including 0 and n-1)

if you turned on compiler warnings you would've seen an out of bounds warning
>>
>>58285460
>if you turned on compiler warnings you would've seen an out of bounds warning
lel
>>
>>58285346
That's a big program 4.000000 you
>>
>>58285598

I don't get it
>>
>>58285598
kek
>>
>>58285346
why such pajeet bro
just int a[1] lmao
>>
>>58285460
>if you turned on compiler warnings you would've seen an out of bounds warning
$ gcc -Wall -Wextra test.c -o test
$
>>
change all of the %f
to
%1.0f

post result
>>
>>58288004
what gcc version?
try with -Wextra too
>>
>>58285346
>programming C on Windows
truly blasphemous
>>
>>58285694
you must be new here
>>
>>58285694
fucking newfags i swear

>>58288895
They used -Wextra already

>>58289023
What language do you think most Windows software is written in?
>>
File: this-thread.jpg (74KB, 396x382px) Image search: [Google]
this-thread.jpg
74KB, 396x382px
>>58285346
>>58285380
>>58285401
Is this a meme? We've had similar threads 4 days in a row now.
>>
>>58289215
>>58289528

>a-am i fitting in yet?
Thread posts: 20
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.