LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-16-2003, 07:01 PM   #1
Wonko the Sane
LQ Newbie
 
Registered: Nov 2002
Location: Raleigh, NC
Distribution: Gentoo
Posts: 20

Rep: Reputation: 0
cpp: pointers


lab7.cpp:126: invalid conversion from `int*' to `int'
lab7.cpp:128: invalid conversion from `int' to `int*'

Code:
 126                                int tmp = *(&a+cnt);
 127                                *(&a+cnt) = *(&a+cnt+1);
 128                                *(&a+cnt+1) = tmp;
am I missing anything, this should be practically obvious.
 
Old 11-16-2003, 08:00 PM   #2
Stack
Member
 
Registered: Oct 2003
Distribution: FreeBSD
Posts: 325

Rep: Reputation: 30
126 your trying to store a pointer in an integer
128 your trying to store an integer in a pointer

pretty obvious to me what is wrong...
 
Old 11-16-2003, 08:09 PM   #3
Wonko the Sane
LQ Newbie
 
Registered: Nov 2002
Location: Raleigh, NC
Distribution: Gentoo
Posts: 20

Original Poster
Rep: Reputation: 0
Yes, but i'm dereferencing, i hope.
 
Old 11-17-2003, 03:38 AM   #4
LOUDSilence
Member
 
Registered: Oct 2003
Location: Sydney
Distribution: Red Hat 8
Posts: 77

Rep: Reputation: 15
Pointers are not the actual value but a pointer to the value. If you do not understand this you should look at a learning C or C++ site as this is very important.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cpp error ashirazi Programming 1 09-18-2004 05:49 PM
debian dpkg cpp depends on cpp error darkleaf Linux - Software 2 06-25-2004 01:47 AM
ORBit-2.0-cpp - what is this? Louis_Carole Linux - Newbie 1 04-04-2004 07:25 PM
CPP error, please help... TomAL Mandriva 3 12-24-2003 09:57 AM
Now I have gcc/cpp/cpp, but still can't install sfingerh Linux - Software 2 07-30-2002 03:13 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration