[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
In this thread we write one fact about ANY technology or programming
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 10
Thread images: 3
File: 1460927877559.jpg (649 KB, 900x2200) Image search: [Google]
1460927877559.jpg
649 KB, 900x2200
In this thread we write one fact about ANY technology or programming language to teach each other. Also post infographics.

In C programming language, the #include preprocessor directive includes the header file contents to the source code file.
It does a copy-paste from headerfile.h to source.c before the compiler runs, hence it is preprocessing.

#include <someheaderfile.h>
...
>>
In C the function called "main" is special, the program starts from the first instruction in this function.

Example main function:
int main(void)
{
/*first instruction to be executed goes here*/
return 0
}
>>
The sequence of generating a program from C source code is as follows:
1. preprocessor (directives like #include etc.)
2. compiler (translates C source code to assembly)
3. assembler (translates assembly to machine code)
4. linker (embeds machine code in an executable file eg. ELF)
>>
The knapsack problem is an example of NP-complete problems.
For any k items, each having it's own weight w we are looking for such a subset of these items, so that the sum of weights inside the subset is equal to some N. In the worst case, we must check each of the 2^k subsets. If it was possible to solve the problem in polynomial (not exponential) time, then we'd prove that P=NP and get a million $.
>>
>>55097994
using the single line comment syntax

    //comment


or declaring the iteration counrer variable in a for loop like

    for (int i = 0; i < 10; i++) {
;
}


are both invalid in ANSI C or C89
a lot of C programmers don't know this because most modern compilers default to C99
>>
>>55098198
Ha! But I knew this. Anyway, it's cool that you wrote about it. I'm really pedantic about ANSI C in my simple programs.

On GNU/Linux OS one can easily see the USB devices by typing in the terminal emulator: lsusb
>>
>>55098222
>I'm really pedantic about ANSI C in my simple programs.
me too, I always write a little buildscript to call the compiler with a bunch of options including -ansi so it will fail to compile if I break the C89 standard.
>>
File: what-language-should-you-learn.jpg (1 MB, 700x8246) Image search: [Google]
what-language-should-you-learn.jpg
1 MB, 700x8246
>>55097994
>>
File: infographics.jpg (500 KB, 1232x1404) Image search: [Google]
infographics.jpg
500 KB, 1232x1404
>>55098325
>>
>>55098398
why the tease? dump them
Thread replies: 10
Thread images: 3

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.