C – Pointers and String

After reading this pointers and string topic, you will understand its theory and examples also you will able to implement it in C programming.

A string is an array of characters and we can declare and operate string with pointer in C programming. The example below will show how pointers and string used in C programming.

Example:

Program (1): To demonstrate pointers and string in C programming.

#include<stdio.h>
#include<conio.h>
void main(void)
{
char a[]="C PROGRAMMING";
int i=0;
while(a[i])
{
printf(
i++;
}
getch();
}

Output (1)

C PROGRAMMING

Published by

Electrical Workbook

We provide tutoring in Electrical Engineering.

Leave a Reply

Your email address will not be published. Required fields are marked *