Let us see another example to better understand the use of pointers

Files Recovery Software
Home Contact Details Customer Support Download Demo Products  

 
 

Let us see another example to better understand the use of pointers:

#include <stdio.h>
#include <string.h>

int main()
{

char strg[40], *there, one, two;
int *pt, list[100], index;

strcpy(strg, "This is a character string.");

/* the function strcpy() is to copy one string to another. we’ll read about strcpy() function in String Section later */

one = strg[0]; /* one and two are identical */
two = *strg;

printf("The first output is %c %c\n", one, two);

one = strg[8]; /* one and two are identical */
two = *(strg+8);

printf("The second output is %c %c\n", one, two);

there = strg+10; /* strg+10 is identical to &strg[10] */

printf("The third output is %c\n", strg[10]);
printf("The fourth output is %c\n", *there);

for (index = 0 ; index < 100 ; index++)

list[index] = index + 100;
pt = list + 27;

printf("The fifth output is %d\n", list[27]);
printf("The sixth output is %d\n", *pt);

return 0;
}

The output of the program will be like this:

The first output is T T
The second output is a a
The third output is c
The fourth output is c
The fifth output is 127
The sixth output is 127

Previous page

page 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20

 
 

page 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37

 
 

page 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54

 
 

page 55 | 56 | 57 | 58 | 59 | 60

Next page
 
 
Data Recovery Book
 
Chapter 1 An Overview of Data Recovery
Chapter 2 Introduction of Hard Disks
Chapter 3 Logical Approach to Disks and OS
Chapter 4 Number Systems
Chapter 5 Introduction of C Programming
Chapter 6 Introduction to Computer Basics
Chapter 7 Necessary DOS Commands
Chapter 8 Disk-BIOS Functions and Interrupts Handling With C
Chapter 9 Handling Large Hard Disks
Chapter 10 Data Recovery From Corrupted Floppy
Chapter 11 Making Backups
Chapter 12 Reading and Modifying MBR with Programming
Chapter 13 Reading and Modifying DBR with Programming
Chapter 14 Programming for “Raw File” Recovery
Chapter 15 Programming for Data Wipers
Chapter 16 Developing more Utilities for Disks
Appendix Glossary of Data Recovery Terms
 
 

Pro Data Doctor

Home

Products

Contact Details

Customer Support

Download Demo

Terms and Conditions

 
Pro Data Doctor