c compile

Posted on 1999-06-24
Medium Priority
Last Modified: 2013-12-15

im new to linux, i tried to compile the following code with the command "gcc -o test test.c"

  main ()

the program compiled but when i run the program, nothing happens. I want to program to print in the command promt, how is this done?

Question by:spat
1 Comment

Accepted Solution

gunny051499 earned 400 total points
ID: 1628878
#include <stdio.h>

        printf("Hello world!\n");

to print the command prompt, either print it as a fixed string, or get the environment variable PS1 (function "getenv" - see manualpage "man getenv"), interprete it and print it out correctly. this however will be up to you ;)

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This article explains how to use the rsync command to create backups and sync data across hosts. Rsync is a very useful command that is often used to copy data, make backups, migrate hosts, and bridge the gap between site staging and production envi…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

587 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question