ankitweblogic logo
W e b t u t o r i a l s

C Tutorial

Programing Approach


Flow Chart

Define C

Define Programming

C - Syntax

Compiler vs Interpreter

C - Variables

C - Keywords

C - Data Types

C - Comments

Turbo C - Shortcut keys

C - Operators

Hierarchy of Operators

Ex: Arithmetic Operator

C - Formatting Output

Constant Variable

C - Escape Sequence

C - if , switch

Ex: If condition

Ex: Inc / Dec Operator

C - loops

Ex: Loops

C - Nesting Of loops

Ex: Nested Loops

Jumping Statements

C - Arrays 1D

C - Arrays 2D

C - Sorting


Character I/O Function

C - String Functions

Ex: Strings

Array of Strings

C - Math Functions

User-defined Function

Exercise Function

C - Types of Functions

Storage Class

C - Header Files

C - Preprocessor

C - Pointers

C - Structures

C - Typedef

C - File Handling

Ex: File Handling

Command Line Argument


C - Array of Strings

A string is a 1-D array of characters, so an array of strings is a 2-D array of characters.

Just like we can create a 2-D array of int, float etc; we can also create a 2-D array of character or array of strings.

Syntax for declaring a 2-D array of characters:

char prg[3][12] = {
   {'c', 'o', 'd', 'i', 'n', 'g', '\0'},
   {'l', 'e', 'a', 'r', 'n', 'i', 'n', 'g', '\0'},
   {'p', 'r', 'o', 'g', 'r', 'a', 'm', 'm', 'i', 'n', 'g', '\0'}

This above initialization is equivalent to:

char prg[3][12] = {

Exercise questions on Array of Strings

  1. Input 10 names and print them.
  2. #include<stdio.h>
    void main()
        char name[10][20];
        int i;
        printf("Enter 10 names: ");
        printf("Input Names are:\n");
  3. Input 10 names and find largest word (take ASCII value for comparing).
  4. Input 10 names and find smallest word (take ASCII value for comparing).
  5. Input 10 names and sort them in ascending order.
  6. Input 10 names and sort them in descending order.