[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]

gcc version 4.9.2 (Debian 4.9.2-10)

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: 15
Thread images: 2

File: gcc-segfaults.png (3KB, 115x144px) Image search: [Google]
gcc-segfaults.png
3KB, 115x144px
>segfaults
What's your excuse?
>>
>>60103831
they're uninitialised...
>>
>>60103831
>t. I don't have a clue about C
>>
>>60103831
You literally have no clue how C works.

If you do int a;, then the data you get in a to start with is uninitialized, it could be anything. Well an int* holds a memory address. When you do
int* a;
the address that a holds could point literally anywhere, it's garbage data.

You need to do
int* a = calloc(1, sizeof(int));
, and then you need to re-read the first chapter of your C textbook
>>
do this instead opie

int main(){
int a;
int b;
int c;
*(&a) = 10;
*(&b) = 20;
*(&c) = 30;
return 0;
}
>>
>>60103831
You're assigning the integer values 10, 20 and 30 to random memory locations that you don't own.
>>
>>60103831
I don't like C but you are just plain retarded
>>
File: gcc.png (17KB, 543x148px) Image search: [Google]
gcc.png
17KB, 543x148px
>>60103831
>gcc 4.9.2
topfuckingkek
>>
>>60103905
calloc? Why not use malloc?
>>
>>60103964
pacman -Qi gcc
>>
I was under the impression that C would also allocate space on the stack for the pointers values. I kind of forgot that it doesn't.
>>
>>60103987
Just habit I guess. malloc would work as well, but calloc memsets it to zero before it returns it
>>
>>60103964
That's nothing, the latest version of Centos has 4.8.5 and slitaz has 4.6.3
>>
>>60104022
>calloc memsets it to zero before it returns it
Totally useless, especially if you initialize to something else just after.
>>
>>60103831
C IS INSECURE AS DEMONSTRATED ITT
C IS FINISHED AND BANKRUPT
C BTFO
Thread posts: 15
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.