C
source code, by itself is portable, i.e. you may compile the same source code both on
Windows
and on
Linux
(
Ubuntu
is
Linux
) and obtain a program showing the same behviour.
However, as you interact with
OS API
calls (and all but trivial programs do it) the portability is broken, because, for instance Windows provides a
Sleep
call while Linux does not. So most of
C
non-trivial programs are non portable.
If you aim to portability, however, there are workarounds: have a look, for instance, at
Cygwin[
^].
If you aren't stuck with
C
, then you may consider the 'write once run everywhere' solution (that is
Java[
^]) or
C#
(available on
Linux
via
Mono[
^]).