On Sat, Apr 10, 2010 at 9:14 PM, Jesus Sanchez <zexe...@gmail.com> wrote:

>   This is not really OpenBSD related but since it's a UNIX-like OS and
> here are really experienced people coding in C I thought this was a good
> place to ask.
>

Actually, not.  Your questions are general C programming questions.  A
number of sites exist which thrive on questions like this.  Sometimes, they
actually give the right answers.


> Back to a.c later than the 0x2211
> assignement I printed the variable and showed 0x11 (at that point i
> realized the mistake). But I was just wondering where the h*ll went the
> 0x22 bits on the memory??


Truncated.


>   I know the rigth thing is to declare the variable 'foo' on a header
> file and include it in all my code...


No, this is incorrect.  It is a poor idea to declare variables within header
files.  This bad practice will lead to linker errors due to duplicate
definitions.

One solution is to define all global variables in a single *.c file & place
extern statements to each of these global variables in a header file which
can then be included as many times in as many places as you choose.  Here,
all global variables are defined only once which is required.

Reply via email to