Skip to main content

Posts

Showing posts from August 18, 2018

Hello World C Problem

Hello World C Problem In this post, we will give some problems which are based on our Hello World Program in C  post. Please try to solve these problems by yourself before googling or looking at our solutions. Write a C program that prints your name           Output :            Name: Your Name          Solution     2. Write a C program that prints your name, school/college name, branch           Output:           Name: Your Name           School/College Name: Your School/College Name           Branch: Your Branch           Solution Note: For newline you can you can '\n' .    Example: printf("Hello World\n")

Hello World in c

FIRST PROGRAM IN C In this tutorial, We will write our first C program and understand the program structure in c. We will also see how to compile and run a C program. Introduction In this section, we will write our first program that will print  Hello World  on the terminal. Create File/Open Editor Create a file with name hello_world.c . Note that you can keep the name of file anything, but it is best practice to keep the name that related to the content of the file. C program file extension is .c  means you can replace hello_world  with any string but .c is compulsory.  Write Hello World in C Type below code in your hello_world.c file #include <stdio.h> int main () { printf ( "Hello World" ); return 0 ; } How C Program Work   #include <stdio.h>:  This is a preprocessor command which tells the compiler to include the contents of stdio.h file in the program. stdio.h file contains functions such as ...

How to Compile and Run a C Program on Ubuntu Linux

How to Compile and Run a C Program on Ubuntu Linux In this post, we will learn how to set up an environment to compile and execute a c program on Ubuntu. Introduction In order to compile and execute a C program on Ubuntu, you need the following software GNU Compiler Collection (GCC)  Editor GNU Compiler Collection (GCC)  The good news is that the GNU Compiler Collection (GCC)  by default installed on your system you test via the following guideline. Search for the terminal tool application in dash tool. Click once on the icon to open dash tool Dash tool located on the left-top corner of your system. Search word terminal in dash tool Open terminal. Click on the terminal icon in order to open it. this will open terminal something like below.  Check the GCC installation. type gcc --help  on the terminal and hit the enter key    this will display all available command in GCC. Editor You also ...