C Programming Tutorial

 

The First C Program

To start with the first program lets write what we actually want to instruct the Computer Processor to do:


a. I want the Computer Processor to display character that I type.
b. I want it to be displayed on the Computer Monitor Screen.
c. I will type the character on my keyboard and I want the Computer Processor to read what I typed.

In order to do all of this certainly we need a complete Computer Set System and obviously by reading this tutorial you already got everything.

Lets write the program on the C Compiler.
Open the C Compiler and open new file to write C program.

Write the program and save it as First.c.

#include <stdio.h>

int main()
{
    printf("Processor please display this character!\n");
    return 0;
}


Compile the C program as shown below:

Run the program and the output is shown below:

When executed, this program instructs the computer to print out the line - Processor please display this character! -- then the program quits. To make the program display the output until we type any character just add C code getchar() inside the program.

#include <stdio.h>

int main()
{
    printf("Processor please display this character!\n");
    getchar();  //output will wait until user type any
                //charr on the keyboard
    return 0;
}

c001

c002

 

Microcontroller

What is a Microcontroller?

Microcontroller Specification

Programming PIC16F877A

Playing with a C Programming and PIC16F877A

Creating a Digital Clock using PIC16F877A, LCD and DS1337 Clock IC from Dallas

How to Load Hex File into PIC16F877A

 

Articles :

Lightning Surge Testing

Bit Error Rate Testing

Insertion Loss Testing

 

Light Emitting Diode

DC Power Jack

Voltage Regulator and Diode

Transistor and Operational Amplifier

Trimmer Pot, Relay and PCB

 

Understanding PIC16F877A

Product Development Using PIC16F877A

More Product Development Using PIC16F877A

PIC16F877A Input Output Overview

Interfacing PIC16F877A With LCD

 

VoIP Basic

VoIP Phone

Using VoIP Through Normal PSTN Telephone

What is Codec?

 

C Programming Tutorial

Introduction

What is C programming language?

The First C Program

The First C Program - Explanation

Variables

Printf

Reading User Values

Scanf

Looping

Using FOR loop

Arrays

More on Arrays

Example Program that use Arrays to Compare 6 PIN number

If, Else If, Else

Functions

Pointers

Summary

 

 

 

 

 

 

 

 

 

 

 

Copyright www.electronics.netmyne.com.