New Member FAQ
|
Forums
|
Earn Revenue
Resources
Entrance
Ask Experts
Exam Papers
Jobs
English
Projects
Universities
Colleges
Courses
Schools
Training
My India
Members
|
Communities
|
Business Directory
|
Classifieds
|
Reviews
|
Silverlight Games
|
Peer Appraisal
|
Bookmarks
|
Polls
|
Mentors
|
Links
|
B.Tech Projects
|
Lobby
|
Gift Shop
|
Chat
|
New Posts
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
Raghav Sharma
(383)
karthik
(117)
Muthukumar
(105)
Last 7 Days
Raghav Sharma
(857)
karthik
(833)
N K Ravishanka...
(709)
more...
Awards & Gifts
Online Exams
Aptitude Questions
General Aptitude Tests
Medical Entrance
Engineering Entrance
Bank Tests
TOEFL & IELTS Questions
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
C++ Program - Subtracting Pointers
Posted Date: Total Responses:
0
Posted By:
K Dinesh Reddy
Member Level:
Diamond
Points/Cash
: 2
// Subtracting Pointers
#include
using namespace std;
int main()
{ char s[] = "ABCDEFGHIJ";
char* p = &s[3]; // p points to s[3]
char* q = &s[6]; // q points to s[6]
cout << "*p = " << *p << ", *q = " << *q << endl;
--p; // p points to s[2]
++q; // q points to s[7]
cout << "*p = " << *p << ", *q = " << *q << endl;
cout << "q - p = " << q - p << endl;
system("pause");
return 0;
}
// The Output is
// *p = D, *q = G
// *p = C, *q = H
// q - p = 5
Project Feedbacks
No feedbacks found. Be the first to respond and make money from
revenue sharing program
.
Post Feedback
You must
Sign In
to post a feedback.
Next Project:
C++ Program - Pointer Arithmetic
Previous Project:
C++ Program - More Pointer Arithmetic
Return to Project Index
Post New Project
Related Projects
CHOICE BOX In java
WAN Optimization Caching Client
Get the current time
Sales Management System
C program to perform operation on Double Link List
Contact Us
Advertise
Editors
Privacy Policy
Terms Of Use
AdSense Revenue Sharing sites
ISC Technologies.
2006 - 2009 All Rights Reserved.