Coding Practice

Write a program in C to print all alphabets using pointer

Print all alphabets using pointer
Sample Output
Print all alphabets from a to z using pointer.
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z

Process returned 0 (0x0)   execution time : 0.062 s
Press any key to continue.
Source Code
#include<stdio.h>

int main()
{
    char ch = 'a';
    char *ch_pointer;

    ch_pointer = &ch;

    printf("Print all alphabets from a to z using pointer.\n");
    while(ch <= 'z')
    {
        printf("%c\n", *ch_pointer);
        ch++;
    }
    return 0;
}
Sample Output
Print all alphabets from a to z using pointer.
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z

Process returned 0 (0x0)   execution time : 0.062 s
Press any key to continue.

No comments:

Post a Comment

Change Theme
X